From 5218f2094c8de0ac3a90427ec606d5dd09eae78d Mon Sep 17 00:00:00 2001 From: Alex <Alex> Date: Fri, 2 Aug 2024 12:37:38 +0300 Subject: [PATCH] There were change logic for get applicationPath --- params.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/params.cpp b/params.cpp index 3e69845..6bbe5ed 100644 --- a/params.cpp +++ b/params.cpp @@ -12,9 +12,8 @@ #include <QDateTime> #include <QCoreApplication> #include "qaglobalutils.h" -#include <QDir> #include <QtLogging> - +#include <mach-o/dyld.h> #ifdef Q_OS_WIN #include "windows.h" @@ -232,7 +231,15 @@ bool Params::parseParams(const QStringList ¶msArray, const OptionsDataList & #endif #ifdef Q_OS_DARWIN - appPath = QDir::currentPath(); + uint32_t size = 0; + _NSGetExecutablePath(nullptr, &size); // request to buffer size + std::vector<char> buffer(size); + if (_NSGetExecutablePath(buffer.data(), &size) == 0) { + appPath = QString::fromUtf8(buffer.data()); + } else { + appPath = QString(); + } + appName = QCoreApplication::applicationName(); #endif