diff options
author | Simon Rettberg | 2016-11-07 15:47:26 +0100 |
---|---|---|
committer | Simon Rettberg | 2016-11-07 15:47:26 +0100 |
commit | a8a717221c2f485bcdd9bbfa7b24e1c61083e95e (patch) | |
tree | f6086f57f6c2e29e21cea684ac09ebeadccc8eb9 /src | |
parent | modify the pvs checkbox when in exam-mode. (mandatory). (diff) | |
download | vmchooser2-a8a717221c2f485bcdd9bbfa7b24e1c61083e95e.tar.gz vmchooser2-a8a717221c2f485bcdd9bbfa7b24e1c61083e95e.tar.xz vmchooser2-a8a717221c2f485bcdd9bbfa7b24e1c61083e95e.zip |
Fallback to user/default config if cmdline config was not found; print config path used
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp index 5e18c8c..e511c09 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -86,12 +86,12 @@ int main(int argc, char *argv[]) { } std::cerr << a.translate("Console", - "vmchooser: failed to run session").toUtf8().data() + "vmchooser: failed to run session").toUtf8().constData() << std::endl; return EXIT_FAILURE; } else { std::cerr - << a.translate("Console", "vmchooser: invalid session file").toUtf8().data() + << a.translate("Console", "vmchooser: invalid session file").toUtf8().constData() << std::endl; return EXIT_FAILURE; } @@ -103,12 +103,24 @@ int main(int argc, char *argv[]) { // global vmchooser.conf QString confFile; if (cmdOptions.contains("config")) { - confFile = cmdOptions.value("config"); - } else if (QFileInfo(userConfFile).exists()) { + if (QFileInfo(cmdOptions.value("config")).exists()) { + confFile = cmdOptions.value("config"); + } else { + std::cerr << a.translate("Console", "Requested --config not found: ").toUtf8().constData() << cmdOptions.value("config").toUtf8().constData() << std::endl; + } + } + if (confFile.isEmpty() && QFileInfo(userConfFile).exists()) { confFile = userConfFile; - } else { + std::cerr << a.translate("Console", "Using user specific config: ").toUtf8().constData() << userConfFile.toUtf8().constData() << std::endl; + } + if (confFile.isEmpty() && QFileInfo(globalConfFile).exists()) { confFile = globalConfFile; + std::cerr << a.translate("Console", "Using global config: ").toUtf8().constData() << globalConfFile.toUtf8().constData() << std::endl; + } + if (confFile.isEmpty()) { + std::cerr << a.translate("Console", "No config file found or given").toUtf8().constData() << std::endl; } + // TODO: This is the system wide settings, give proper name QSettings settings(confFile, QSettings::IniFormat); settings.setIniCodec("UTF-8"); |