summaryrefslogtreecommitdiff
path: root/client/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'client/main.cpp')
-rw-r--r--client/main.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/client/main.cpp b/client/main.cpp
index 9e85eb4..9fd9c58 100644
--- a/client/main.cpp
+++ b/client/main.cpp
@@ -1,13 +1,40 @@
+#include <stdio.h> /* defines FILENAME_MAX */
+#ifdef WINDOWS
+ #include <direct.h>
+ #define GetCurrentDir _getcwd
+#else
+ #include <unistd.h>
+ #define GetCurrentDir getcwd
+#endif
+#include <errno.h>
+
+#include <QString>
+#include <QFileInfo>
#include "ProxyClientApp.h"
#include "client.h"
-#include "Dialog.h"
ProxyClientApp *this_app;
int main(int argc, char *argv[])
{
Logger::Info("Starting client application\n");
- this_app = new ProxyClientApp(argc, argv);
+ char currentPath[FILENAME_MAX];
+ if (! GetCurrentDir(currentPath, sizeof(currentPath)))
+ {
+ return errno;
+ }
+ // check if initial config exists (config.cfg)
+ // without it application is useless
+ QString configPath = QString::fromLocal8Bit(currentPath) + "/config.cfg";
+ QFileInfo configInfo(configPath);
+ if (! configInfo.exists())
+ {
+ Logger::Fatal("Initial configuration file (config.cfg) do not exist!\n");
+ Logger::Fatal("Terminating!\n");
+ return -1;
+ }
+
+ this_app = new ProxyClientApp(argc, argv);
return this_app->exec();
}