From 03a9326ebc994cba917476f3bf64c8a5ea32696a Mon Sep 17 00:00:00 2001 From: Alexander Yee Date: Mon, 10 Aug 2026 01:04:11 -0700 Subject: [PATCH] Migrate some of Linux GlobalAutoPaths away from Qt. --- .../CommonFramework/GlobalAutoPaths.cpp | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/SerialPrograms/Source/CommonFramework/GlobalAutoPaths.cpp b/SerialPrograms/Source/CommonFramework/GlobalAutoPaths.cpp index 844f0de064..9057c3cbb8 100644 --- a/SerialPrograms/Source/CommonFramework/GlobalAutoPaths.cpp +++ b/SerialPrograms/Source/CommonFramework/GlobalAutoPaths.cpp @@ -14,6 +14,10 @@ #include "Common/Cpp/Filesystem/Filesystem.h" #include "GlobalAutoPaths.h" +#ifdef __linux__ +#include +#endif + //#include //using std::cout; //using std::endl; @@ -58,13 +62,17 @@ Filesystem::Path get_application_base_dir_path(){ #if defined(__linux__) // Check for AppImage environment variables to find the root directory, if running as an AppImage. // PA_APPIMAGE_DIR is set by Azure via a patched AppRun script. - QByteArray dir = qgetenv("PA_APPIMAGE_DIR"); - if (!dir.isEmpty()){ - return QString::fromUtf8(dir).toStdString(); + { + char* dir = std::getenv("PA_APPIMAGE_DIR"); + if (dir != nullptr){ + return dir; + } } - QByteArray path = qgetenv("APPIMAGE"); - if (!path.isEmpty()){ - return QDir::cleanPath(QFileInfo(QString::fromUtf8(path)).dir().absolutePath()).toStdString(); + { + char* path = std::getenv("APPIMAGE"); + if (path != nullptr){ + return std::filesystem::absolute(path).parent_path().lexically_normal(); + } } QByteArray appDirBytes = qgetenv("APPDIR"); if (!appDirBytes.isEmpty()){