From f0c3ca1c9e1298df80d71c4acfc0194af883ca2d Mon Sep 17 00:00:00 2001 From: Dubslow Date: Tue, 20 Jan 2015 02:24:25 -0600 Subject: [PATCH] check -P option for invalid profiles closes #977 --- src/main.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index ef378bfbc..fe01eb096 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -71,7 +71,16 @@ int main(int argc, char *argv[]) Settings::getInstance(); // Build our Settings singleton as soon as QApplication is ready, not before if (parser.isSet("P")) - Settings::getInstance().setCurrentProfile(parser.value("P")); + { + QString profile = parser.value("P"); + if (QDir(Settings::getSettingsDirPath()).exists(profile + ".tox")) + { + qDebug() << "Setting profile to" << profile; + Settings::getInstance().setCurrentProfile(profile); + } + else + qWarning() << "Warning: -P profile" << profile + ".tox" << "doesn't exist"; + } sodium_init(); // For the auto-updater