History

this uses qt's test location for AppData/Local, but leaves Roaming alone

David Kelly committed 9 years ago

Commit bda50af1 parent 04160f23 files · +11 −18Browse files

Showing the changes to interface/src/main.cpp (1 of 3 files). Show all

Unified · Split

interface/src/main.cpp+9−3
@@ -71,7 +71,7 @@ int main(int argc, const char* argv[]) { · 70 unmodified lines
7171 QCommandLineOption runServerOption("runServer", "Whether to run the server");
7272 QCommandLineOption serverContentPathOption("serverContentPath", "Where to find server content", "serverContentPath");
7373 QCommandLineOption allowMultipleInstancesOption("allowMultipleInstances", "Allow multiple instances to run");
74− QCommandLineOption overrideAppLocalDataPathOption("cache", "Override cache directory", "value");
74+ QCommandLineOption overrideAppLocalDataPathOption("cache", "set test cache directory");
7575 parser.addOption(urlOption);
7676 parser.addOption(noUpdaterOption);
7777 parser.addOption(checkMinSpecOption);
@@ -99,8 +99,14 @@ int main(int argc, const char* argv[]) { · 21 unmodified lines
9999 instanceMightBeRunning = false;
100100 }
101101 if (parser.isSet(overrideAppLocalDataPathOption)) {
102− QString appLocalDataPath = parser.value(overrideAppLocalDataPathOption);
103− PathUtils::getAppLocalDataPath(appLocalDataPath);
102+ // get standard path
103+ auto standardAppDataLocation = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
104+ // set to test so all future paths are the test paths
105+ QStandardPaths::setTestModeEnabled(true);
106+ // now, we need to link everything in AppDataLocation to the test AppDataLocation. This
107+ // leaves the test location for AppLocalDataLocation alone, but allows all the stuff in
108+ // AppDataLocation to be usable
109+ QFile::link(standardAppDataLocation, QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
104110 }
105111
106112 if (instanceMightBeRunning) {