Make use of std::filesystem::path and cleanup specification error messages

This commit is contained in:
Alexander Bock
2021-02-13 12:00:26 +01:00
parent c039258f64
commit dfa223abef
6 changed files with 52 additions and 33 deletions
+10 -2
View File
@@ -189,7 +189,11 @@ TestResult FileVerifier::operator()(const ghoul::Dictionary& dict,
std::string file = dict.value<std::string>(key);
if (!std::filesystem::exists(file) || !std::filesystem::is_regular_file(file)) {
res.success = false;
res.offenses.push_back({ key, TestResult::Offense::Reason::Verification });
TestResult::Offense off;
off.offender = key;
off.reason = TestResult::Offense::Reason::Verification;
off.explanation = "File did not exist";
res.offenses.push_back(off);
}
return res;
}
@@ -209,7 +213,11 @@ TestResult DirectoryVerifier::operator()(const ghoul::Dictionary& dict,
std::string dir = dict.value<std::string>(key);
if (!std::filesystem::exists(dir) || !std::filesystem::is_directory(dir)) {
res.success = false;
res.offenses.push_back({ key, TestResult::Offense::Reason::Verification });
TestResult::Offense off;
off.offender = key;
off.reason = TestResult::Offense::Reason::Verification;
off.explanation = "Directory did not exist";
res.offenses.push_back(off);
}
return res;
}