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
71 QCommandLineOption runServerOption("runServer", "Whether to run the server");71 QCommandLineOption runServerOption("runServer", "Whether to run the server");
72 QCommandLineOption serverContentPathOption("serverContentPath", "Where to find server content", "serverContentPath");72 QCommandLineOption serverContentPathOption("serverContentPath", "Where to find server content", "serverContentPath");
73 QCommandLineOption allowMultipleInstancesOption("allowMultipleInstances", "Allow multiple instances to run");73 QCommandLineOption allowMultipleInstancesOption("allowMultipleInstances", "Allow multiple instances to run");
74 QCommandLineOption overrideAppLocalDataPathOption("cache", "Override cache directory", "value");74 QCommandLineOption overrideAppLocalDataPathOption("cache", "set test cache directory");
75 parser.addOption(urlOption);75 parser.addOption(urlOption);
76 parser.addOption(noUpdaterOption);76 parser.addOption(noUpdaterOption);
77 parser.addOption(checkMinSpecOption);77 parser.addOption(checkMinSpecOption);
@@ -99,8 +99,14 @@ int main(int argc, const char* argv[]) { · 21 unmodified lines
99 instanceMightBeRunning = false;99 instanceMightBeRunning = false;
100 }100 }
101 if (parser.isSet(overrideAppLocalDataPathOption)) {101 if (parser.isSet(overrideAppLocalDataPathOption)) {
102 QString appLocalDataPath = parser.value(overrideAppLocalDataPathOption);102 // get standard path
103 PathUtils::getAppLocalDataPath(appLocalDataPath);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));
104 }110 }
105 111
106 if (instanceMightBeRunning) {112 if (instanceMightBeRunning) {