diff options
-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"); |