Add a commandline argument to override the cache directory

This commit is contained in:
Alexander Bock
2016-09-21 22:10:59 +02:00
parent a45621948d
commit a85356dcff

View File

@@ -112,6 +112,7 @@ namespace {
std::string configurationName;
std::string sgctConfigurationName;
std::string sceneName;
std::string cacheFolder;
} commandlineArgumentPlaceholders;
}
@@ -283,6 +284,14 @@ bool OpenSpaceEngine::create(int argc, char** argv,
return false;
}
if (!commandlineArgumentPlaceholders.cacheFolder.empty()) {
FileSys.registerPathToken(
"${CACHE}",
commandlineArgumentPlaceholders.cacheFolder,
ghoul::filesystem::FileSystem::Override::Yes
);
}
// Initialize the requested logs from the configuration file
_engine->configureLogging();
@@ -599,6 +608,14 @@ bool OpenSpaceEngine::gatherCommandlineArguments() {
"the scene file, overriding the value set in the OpenSpace configuration file"
));
commandlineArgumentPlaceholders.cacheFolder = "";
_commandlineParser->addCommand(std::make_unique<SingleCommand<std::string>>(
&commandlineArgumentPlaceholders.cacheFolder, "-cacheDir", "", "Provides the "
"path to a cache file, overriding the value set in the OpenSpace configuration "
"file"
));
return true;
}