39 std::filesystem::path testPath(
value);
41 }
catch (
const std::exception &) {
42 return "Error in path syntax: \"" +
value +
"\".";
48 if (
value.empty() || !std::filesystem::exists(
value))
49 return "Directory \"" +
value +
"\" not found";
50 if (!std::filesystem::is_directory(
value))
51 return "Directory \"" +
value +
"\" specified is actually a file";
52 }
catch (
const std::filesystem::filesystem_error &) {
53 return "Error accessing directory \"" +
value +
"\"";
double value
The value of the point.
IValidator_sptr clone() const override
Clone the validator.
DirectoryValidator(bool testDirectoryExists=true)
Constructor.
std::vector< std::string > allowedValues() const override
Returns the set of valid values.
std::string checkValidity(const std::string &value) const override
If m_fullTest=true if checks that the files exists, otherwise just that path syntax looks valid.
FileValidator is a validator that checks that a filepath is valid.
bool m_testExist
Flag indicating whether to test for existence of filename.
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.