X-Git-Url: https://vaikene.ee/gitweb/pswgen11.html?a=blobdiff_plain;ds=sidebyside;f=src%2Flibs%2FCommon%2Fenv.cpp;h=9f72a8cebdaedcea415a8134eaccd546b8221131;hb=563d9c2c35a46b11566ec8440beeb8006bc6aeb0;hp=e0c08348628741c1723d31a2b694ebfbd6a26eee;hpb=e76495e33c8a48c2e2cd2cb24d99783d22dff67e;p=evaf
diff --git a/src/libs/Common/env.cpp b/src/libs/Common/env.cpp
index e0c0834..9f72a8c 100644
--- a/src/libs/Common/env.cpp
+++ b/src/libs/Common/env.cpp
@@ -24,7 +24,6 @@
#include "iapp.h"
#include
-#include
//-------------------------------------------------------------------
@@ -75,8 +74,20 @@ bool Env::init()
mLogDir.clear();
mDocDir.clear();
+ // Set the data root directory
+#ifdef Q_OS_LINUX
+ QString dataLoc = QDir::homePath();
+ if (!dataLoc.endsWith('/'))
+ dataLoc.append('/');
+ dataLoc.append(".local/share/data/");
+ mDataRootDir = dataLoc + iApp::instance()->name();
+ if (!mDataRootDir.endsWith('/'))
+ mDataRootDir.append('/');
+#endif
+ /// @TODO: Needs local data directory on Windows
+
// Process the environment
- QStringList env = QProcess::systemEnvironment();
+ QStringList env = QProcessEnvironment::systemEnvironment().toStringList();
int sz = env.size();
for (int i = 0; i < sz; ++i) {
// Get the name/value pair
@@ -159,15 +170,9 @@ bool Env::init()
QString const Env::dataRootDir() const
{
- if (mDataRootDir.isEmpty()) {
- QString dataLoc = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
- if (!dataLoc.endsWith('/'))
- dataLoc.append('/');
- mDataRootDir = dataLoc.append(iApp::instance()->name());
- if (!mDataRootDir.endsWith('/'))
- mDataRootDir.append('/');
- }
-
+ // Fall-back to the application's root directory if the data root directory is empty
+ if (mDataRootDir.isEmpty())
+ mDataRootDir = rootDir();
return mDataRootDir;
}