aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/main.cpp6
-rw-r--r--src/qt/macoshelper.h1
-rw-r--r--src/qt/macoshelper.mm15
3 files changed, 22 insertions, 0 deletions
diff --git a/src/main/main.cpp b/src/main/main.cpp
index 41b41faa..b0404165 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -78,6 +78,8 @@
#if defined(Q_OS_WIN)
#include <QOpenGLContext>
+#elif defined(Q_OS_MACOS)
+#include "qt/macoshelper.h"
#endif
#ifdef WITH_SCANNER
@@ -323,6 +325,10 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
// start listening
QTimer::singleShot(0, ipc, SLOT(bind()));
+#if defined(Q_OS_MACOS)
+ QDir::setCurrent(QDir(MacOSHelper::bundlePath() + QDir::separator() + "..").canonicalPath());
+#endif
+
// screen settings
// Mobile is designed on 128dpi
qreal ref_dpi = 128;
diff --git a/src/qt/macoshelper.h b/src/qt/macoshelper.h
index a6caa79b..e8dabfbe 100644
--- a/src/qt/macoshelper.h
+++ b/src/qt/macoshelper.h
@@ -36,6 +36,7 @@ class MacOSHelper
public:
static bool isCapsLock();
static bool openFolderAndSelectItem(const QUrl &path);
+ static QString bundlePath();
};
#endif //MACOSHELPER_H
diff --git a/src/qt/macoshelper.mm b/src/qt/macoshelper.mm
index a7fb061d..8f7b4b0f 100644
--- a/src/qt/macoshelper.mm
+++ b/src/qt/macoshelper.mm
@@ -55,3 +55,18 @@ bool MacOSHelper::openFolderAndSelectItem(const QUrl &path)
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:fileURLs];
return true;
}
+
+QString MacOSHelper::bundlePath()
+{
+ NSBundle *main = [NSBundle mainBundle];
+ if (!main)
+ {
+ return {};
+ }
+ NSString *bundlePathString = [main bundlePath];
+ if (!bundlePathString)
+ {
+ return {};
+ }
+ return QString::fromCFString(reinterpret_cast<const CFStringRef>(bundlePathString));
+}