File tree Expand file tree Collapse file tree
SerialPrograms/Source/CommonFramework Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414#include " Common/Cpp/Filesystem/Filesystem.h"
1515#include " GlobalAutoPaths.h"
1616
17+ #ifdef __linux__
18+ #include < cstdlib>
19+ #endif
20+
1721// #include <iostream>
1822// using std::cout;
1923// using std::endl;
@@ -58,13 +62,17 @@ Filesystem::Path get_application_base_dir_path(){
5862#if defined(__linux__)
5963 // Check for AppImage environment variables to find the root directory, if running as an AppImage.
6064 // PA_APPIMAGE_DIR is set by Azure via a patched AppRun script.
61- QByteArray dir = qgetenv (" PA_APPIMAGE_DIR" );
62- if (!dir.isEmpty ()){
63- return QString::fromUtf8 (dir).toStdString ();
65+ {
66+ char * dir = std::getenv (" PA_APPIMAGE_DIR" );
67+ if (dir != nullptr ){
68+ return dir;
69+ }
6470 }
65- QByteArray path = qgetenv (" APPIMAGE" );
66- if (!path.isEmpty ()){
67- return QDir::cleanPath (QFileInfo (QString::fromUtf8 (path)).dir ().absolutePath ()).toStdString ();
71+ {
72+ char * path = std::getenv (" APPIMAGE" );
73+ if (path != nullptr ){
74+ return std::filesystem::absolute (path).parent_path ().lexically_normal ();
75+ }
6876 }
6977 QByteArray appDirBytes = qgetenv (" APPDIR" );
7078 if (!appDirBytes.isEmpty ()){
You can’t perform that action at this time.
0 commit comments