From b96bd8b19d5b44d3380775e0734e784c3eb7ea5a Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 18 Mar 2019 11:24:30 +0100 Subject: App: Add a -temporarycleansettings (-tcs) command line option For people that are too lazy to think about currently unused throw-away temporary directory names. Change-Id: I0c52f3ea2b0dac4ef6cf3f9db646fd5107fa7977 Reviewed-by: Eike Ziller --- src/app/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/app') diff --git a/src/app/main.cpp b/src/app/main.cpp index 0400f523c36..d946f1f201c 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -81,6 +81,7 @@ const char fixedOptionsC[] = " -client Attempt to connect to already running first instance\n" " -settingspath Override the default path where user settings are stored\n" " -installsettingspath Override the default path from where user-independent settings are read\n" +" -temporarycleansetting Use clean settings for debug or testing reasons\n" " -pid Attempt to connect to instance given by pid\n" " -block Block until editor is closed\n" " -pluginpath Add a custom search path for plugins\n"; @@ -94,6 +95,8 @@ const char CLIENT_OPTION[] = "-client"; const char SETTINGS_OPTION[] = "-settingspath"; const char INSTALL_SETTINGS_OPTION[] = "-installsettingspath"; const char TEST_OPTION[] = "-test"; +const char TEMPORARY_CLEAN_SETTINGS1[] = "-temporarycleansettings"; +const char TEMPORARY_CLEAN_SETTINGS2[] = "-tcs"; const char PID_OPTION[] = "-pid"; const char BLOCK_OPTION[] = "-block"; const char PLUGINPATH_OPTION[] = "-pluginpath"; @@ -348,6 +351,7 @@ struct Options std::vector appArguments; Utils::optional userLibraryPath; bool hasTestOption = false; + bool wantsCleanSettings = false; }; Options parseCommandLine(int argc, char *argv[]) @@ -372,6 +376,8 @@ Options parseCommandLine(int argc, char *argv[]) } else if (arg == USER_LIBRARY_PATH_OPTION && hasNext) { ++it; options.userLibraryPath = nextArg; + } else if (arg == TEMPORARY_CLEAN_SETTINGS1 || arg == TEMPORARY_CLEAN_SETTINGS2) { + options.wantsCleanSettings = true; } else { // arguments that are still passed on to the application if (arg == TEST_OPTION) options.hasTestOption = true; @@ -424,7 +430,7 @@ int main(int argc, char **argv) #endif QScopedPointer temporaryCleanSettingsDir; - if (options.settingsPath.isEmpty() && options.hasTestOption) { + if (options.settingsPath.isEmpty() && (options.hasTestOption || options.wantsCleanSettings)) { temporaryCleanSettingsDir.reset(new Utils::TemporaryDirectory("qtc-test-settings")); if (!temporaryCleanSettingsDir->isValid()) return 1; -- cgit v1.2.3