Commit b5fe4a9a by Maarten L. Hekkelman

locating resources that might be protected

parent 11fea31b
...@@ -1204,15 +1204,18 @@ std::filesystem::path gDataDir; ...@@ -1204,15 +1204,18 @@ std::filesystem::path gDataDir;
void addDataDirectory(std::filesystem::path dataDir) void addDataDirectory(std::filesystem::path dataDir)
{ {
if (VERBOSE > 0 and not fs::exists(dataDir)) std::error_code ec;
std::cerr << "The specified data directory " << dataDir << " does not exist" << std::endl; if (fs::exists(dataDir, ec))
gDataDir = dataDir; gDataDir = dataDir;
else if (VERBOSE > 0)
std::cerr << "The specified data directory " << dataDir << " cannot be used: " << ec.message() << std::endl;
} }
void addFileResource(const std::string &name, std::filesystem::path dataFile) void addFileResource(const std::string &name, std::filesystem::path dataFile)
{ {
if (not fs::exists(dataFile)) std::error_code ec;
throw std::runtime_error("Attempt to add a file resource for " + name + " that does not exist: " + dataFile.string()); if (not fs::exists(dataFile, ec) or ec)
throw std::runtime_error("Attempt to add a file resource for " + name + " that cannot be used (" + dataFile.string() + ") :" + ec.message());
gLocalResources[name] = dataFile; gLocalResources[name] = dataFile;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment