mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-04 00:50:42 +02:00
Not allowing / or spaces in file name prefix (#461)
This commit is contained in:
parent
a4bd2f1be7
commit
f3edd4dc56
@ -1244,6 +1244,9 @@ Result<std::string> Detector::getFileNamePrefix(Positions pos) const {
|
||||
}
|
||||
|
||||
void Detector::setFileNamePrefix(const std::string &fname, Positions pos) {
|
||||
if (fname.find_first_of("/ ") != std::string::npos) {
|
||||
throw RuntimeError("Cannot set file name prefix with '/' or ' '");
|
||||
}
|
||||
pimpl->Parallel(&Module::setFileName, pos, fname);
|
||||
}
|
||||
|
||||
|
@ -572,6 +572,9 @@ TEST_CASE("fname", "[.cmd]") {
|
||||
proxy.Call("fname", {"run"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "fname run\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("fname", {"fdf/dfd"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("fname", {"fdf dfd"}, -1, PUT));
|
||||
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setFileNamePrefix(prev_val[i], {i});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user