summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/ProxyClientApp.cpp12
-rw-r--r--client/main.cpp31
2 files changed, 30 insertions, 13 deletions
diff --git a/client/ProxyClientApp.cpp b/client/ProxyClientApp.cpp
index 4bc5648..f9cbf78 100644
--- a/client/ProxyClientApp.cpp
+++ b/client/ProxyClientApp.cpp
@@ -11,17 +11,7 @@
using namespace std;
ProxyClientApp::ProxyClientApp(int &argc, char *argv[]): QApplication(argc, argv)
-{
- // check if initial config exists (config.cfg)
- QString configPath = this_app->applicationDirPath()+ "/config.cfg";
- QFileInfo configInfo(configPath);
- if (! configInfo.exists())
- {
- Logger::Fatal("Initial configuration file (config.cfg) do not exist!\n");
- Logger::Fatal("Terminating!\n");
- return ;
- }
-
+{
/* initiates UpdatedConfig singleton that start sending configuration requests */
UpdatedConfig *cfg = UpdatedConfig::CurrentConfig();
connect(cfg, SIGNAL(updated()),
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();
}