summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'facetracknoir/main.cpp')
-rw-r--r--facetracknoir/main.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp
index 398f293a..e8a29598 100644
--- a/facetracknoir/main.cpp
+++ b/facetracknoir/main.cpp
@@ -1,3 +1,7 @@
+#ifdef _WIN32
+# include <stdlib.h>
+#endif
+
#include "ui.h"
#include "opentrack/options.hpp"
using namespace options;
@@ -6,9 +10,35 @@ using namespace options;
#include <QStyleFactory>
#include <QStringList>
#include <memory>
+#include <cstring>
+
+#ifdef _WIN32
+// workaround QTBUG-38598, allow for launching from another directory
+static void add_program_library_path()
+{
+ {
+ char* p = _pgmptr;
+ {
+ char path[MAX_PATH];
+ strcpy(path, p);
+ char* ptr = strrchr(path, '\\');
+ if (ptr)
+ {
+ printf("%s\n", path);
+ *ptr = '\0';
+ printf("%s\n", path);
+ QCoreApplication::addLibraryPath(path);
+ }
+ }
+ }
+#endif
+}
int main(int argc, char** argv)
{
+#ifdef _WIN32
+ add_program_library_path();
+#endif
// workaround QTBUG-38598
QCoreApplication::addLibraryPath(".");