From 05e77a8e4f4bc392918aef3046f830dcca23be32 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 4 Dec 2011 20:10:43 +0200 Subject: FIX paths on windows --- client/main.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'client/main.cpp') diff --git a/client/main.cpp b/client/main.cpp index 4b6d734..f3c3d3d 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -1,5 +1,5 @@ -#ifdef WINDOWS +#ifdef WIN32 #define UpdaterName "updater.exe" #define PathSlash "\\" #else @@ -22,8 +22,17 @@ int main(int argc, char *argv[]) Logger::Info("Starting client application\n"); string path = argv[0]; + QString dir; size_t p = path.find_last_of(PathSlash); - QString dir = QString::fromStdString(path.substr(0, p)); + if (p == string::npos) + { + dir = QString::fromStdString("."); + } + else + { + dir = QString::fromStdString(path.substr(0, p)); + } + Logger::Trace("Application path: %s\n", dir.toStdString().c_str()); // check if client should be update -- cgit v1.2.3 From 4fc3551822a57a3b26d0c4540e205f9b340f9899 Mon Sep 17 00:00:00 2001 From: Alex Borisov Date: Sun, 4 Dec 2011 22:38:58 +0200 Subject: FIX reconnection bug & server entry parser --- client/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'client/main.cpp') diff --git a/client/main.cpp b/client/main.cpp index f3c3d3d..f7da59e 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -33,8 +33,6 @@ int main(int argc, char *argv[]) dir = QString::fromStdString(path.substr(0, p)); } - Logger::Trace("Application path: %s\n", dir.toStdString().c_str()); - // check if client should be update QFileInfo newClient(dir + PathSlash + "client.bin.latest"); if (newClient.exists()) @@ -55,6 +53,10 @@ int main(int argc, char *argv[]) // check if initial config exists (config.cfg) // without it application is useless QFileInfo configInfo(dir + PathSlash + "config.cfg"); + + fprintf(stderr, "%s\n", configInfo.fileName().toStdString().c_str()); + + if (! configInfo.exists()) { Logger::Fatal("Initial configuration file (config.cfg) do not exist!\n"); -- cgit v1.2.3