summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-04-13 11:25:56 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-04-13 11:25:56 +0200
commitf9a4ccb88248f3b8b0082caba328b32ffc5d18b0 (patch)
tree16f6a712f845ca6e6b3d89b1bb840981f575ed49 /gui
parent9acf59f2ed02fa769c7cafaf2999bffb53331fd8 (diff)
main: call set-library-paths only after qapplication exists
Otherwise accesses qt install prefix. Issue: #598
Diffstat (limited to 'gui')
-rw-r--r--gui/main.cpp29
1 files changed, 6 insertions, 23 deletions
diff --git a/gui/main.cpp b/gui/main.cpp
index 0ba62ee8..cf6951c2 100644
--- a/gui/main.cpp
+++ b/gui/main.cpp
@@ -2,6 +2,7 @@
# include "opentrack-library-path.h"
# include <stdlib.h>
# include <vector>
+# include <cstring>
# include <QCoreApplication>
# include <QFile>
# include <QString>
@@ -99,23 +100,7 @@ void add_win32_path()
qDebug() << "can't set win32 path";
}
}
-// workaround QTBUG-38598, allow for launching from another directory
-static void add_program_library_path()
-{
- // Windows 10 allows for paths longer than MAX_PATH via fsutil and friends, shit
- const char* p = _pgmptr;
- char path[4096+1];
-
- strncpy(path, p, sizeof(path)-1);
- path[sizeof(path)-1] = '\0';
- char* ptr = strrchr(path, '\\');
- if (ptr)
- {
- *ptr = '\0';
- QCoreApplication::setLibraryPaths({ path });
- }
-}
#endif
int
@@ -124,13 +109,6 @@ WINAPI
#endif
main(int argc, char** argv)
{
-#ifdef _WIN32
- add_program_library_path();
-#elif !defined(__linux)
- // workaround QTBUG-38598
- QCoreApplication::addLibraryPath(".");
-#endif
-
#if QT_VERSION >= 0x050600 // flag introduced in QT 5.6. It is non-essential so might as well allow compilation on older systems.
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
@@ -139,6 +117,11 @@ main(int argc, char** argv)
QTranslator t;
QApplication app(argc, argv);
+#if !defined(__linux) && !defined _WIN32
+ // workaround QTBUG-38598
+ QCoreApplication::addLibraryPath(".");
+#endif
+
set_qt_style();
MainWindow::set_working_directory();