Use `qEnvironmentVariable()` for reading an env variable as `QString`

This is the best function to call in this case according to the
documentation.
This commit is contained in:
Martchus 2023-06-22 20:08:08 +02:00
parent 1648807059
commit 979d92a971
1 changed files with 3 additions and 1 deletions

View File

@ -26,6 +26,8 @@
*/ */
/*********************************************************************************/ /*********************************************************************************/
#include <qtutilities/misc/compat.h>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
@ -312,7 +314,7 @@ void benchMarkResults()
// Returns the location of where the data is stored // Returns the location of where the data is stored
// for an AppImage the dataDir is must be relative to the applicationDirPath // for an AppImage the dataDir is must be relative to the applicationDirPath
QString Util::dataDir() { QString Util::dataDir() {
QString appImagePath = qgetenv("APPIMAGE"); const auto appImagePath = qEnvironmentVariable("APPIMAGE");
if (appImagePath.isEmpty() ) if (appImagePath.isEmpty() )
return QString(PREFIX)+"/"+QString(DATA_DIR); return QString(PREFIX)+"/"+QString(DATA_DIR);