Skip to content
Snippets Groups Projects
Commit 6472571d authored by Nick Draper's avatar Nick Draper
Browse files

Catch potential errors on startup of Mantid

if .mantid or %appdata% directory permissions do not allow writing
re #14404
parent 8be5b3fa
No related merge requests found
......@@ -255,10 +255,27 @@ ConfigServiceImpl::ConfigServiceImpl()
Poco::Path path(appDataDir);
path.pushDirectory("instrument");
Poco::File file(path);
// createdirectories will fail gracefully if it is already present
file.createDirectories();
// createDirectories will fail gracefully if it is already present - but will
// throw an error if it cannot create the directory
try {
file.createDirectories();
} catch (Poco::FileException &fe) {
g_log.error()
<< "Cannot create the local instrument cache directory ["
<< path.toString()
<< "]. Mantid will not be able to update instrument definitions.\n"
<< fe.what() << std::endl;
}
Poco::File vtpDir(getVTPFileDirectory());
vtpDir.createDirectories();
try {
vtpDir.createDirectories();
} catch (Poco::FileException &fe) {
g_log.error()
<< "Cannot create the local instrument geometry cache directory ["
<< path.toString()
<< "]. Mantid will be slower at viewing complex instruments.\n"
<< fe.what() << std::endl;
}
// must update the cache of instrument paths
cacheInstrumentPaths();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment