summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-05-22 06:45:01 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-05-22 06:45:01 +0200
commit45f332f61e687a01129d482c57c880ec7c2f7cac (patch)
treec9b8350b52fe9bfabd210ff9f297af0182fec13a /facetracknoir
parentdf3728933effcb38162e9167bb17c334e807a9b8 (diff)
main: error check for --autostart cmdline option
Pointed-out-by: Fabian Wickborn <fabian@wickborn.net>
Diffstat (limited to 'facetracknoir')
-rw-r--r--facetracknoir/main.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp
index e8a29598..1abf5d6b 100644
--- a/facetracknoir/main.cpp
+++ b/facetracknoir/main.cpp
@@ -9,6 +9,7 @@ using namespace options;
#include <QCommandLineParser>
#include <QStyleFactory>
#include <QStringList>
+#include <QMessageBox>
#include <memory>
#include <cstring>
@@ -24,9 +25,7 @@ static void add_program_library_path()
char* ptr = strrchr(path, '\\');
if (ptr)
{
- printf("%s\n", path);
*ptr = '\0';
- printf("%s\n", path);
QCoreApplication::addLibraryPath(path);
}
}
@@ -69,7 +68,13 @@ int main(int argc, char** argv)
p.process(app);
QString profile = p.value(autostartOption);
- if (!profile.isEmpty())
+
+ bool use_profile = profile.endsWith(".ini") && QFileInfo(profile).exists() && QFileInfo(profile).isFile();
+ if (!profile.isEmpty() && !use_profile)
+ QMessageBox::warning(nullptr, "Can't load profile", "Profile " + profile + " specified but can't be opened!",
+ QMessageBox::Ok, QMessageBox::NoButton);
+
+ if (use_profile)
{
QSettings settings(group::org);
settings.setValue(group::filename_key, MainWindow::remove_app_path(profile));
@@ -77,7 +82,7 @@ int main(int argc, char** argv)
MainWindow w;
- if (!profile.isEmpty())
+ if (use_profile)
w.startTracker();
w.show();