From a85356dcff85b08f66de8e5e8987d92ae022a89f Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 21 Sep 2016 22:10:59 +0200 Subject: [PATCH] Add a commandline argument to override the cache directory --- src/engine/openspaceengine.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 29d5f9934c..35e5e41805 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -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>( + &commandlineArgumentPlaceholders.cacheFolder, "-cacheDir", "", "Provides the " + "path to a cache file, overriding the value set in the OpenSpace configuration " + "file" + )); + + return true; }