aboutsummaryrefslogtreecommitdiff
path: root/path_functions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'path_functions.cpp')
-rw-r--r--path_functions.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/path_functions.cpp b/path_functions.cpp
index e9476d56..c415fa09 100644
--- a/path_functions.cpp
+++ b/path_functions.cpp
@@ -3,22 +3,32 @@
#include "file_functions.h"
#include <QDir>
#include <QDebug>
+#include <QStandardPaths>
#ifdef BASE_OVERRIDE
#include "base_override.h"
#endif
+QString base_path = "";
QString AOApplication::get_base_path()
{
+ if (base_path == "")
+ {
#ifdef BASE_OVERRIDE
- return base_override;
+ base_path = base_override;
#elif defined(ANDROID)
- return "/storage/extSdCard/AO2/";
+ QString sdcard_storage = getenv("SECONDARY_STORAGE");
+ if (dir_exists(sdcard_storage)){
+ base_path = sdcard_storage + "/AO2/";
+ }else{
+ QString external_storage = getenv("EXTERNAL_STORAGE");
+ base_path = external_storage + "/AO2/";
+ }
#else
- return QDir::currentPath() + "/base/";
+ base_path = QDir::currentPath() + "/base/";
#endif
-
-
+}
+ return base_path;
/*
#ifdef OMNI_DEBUG
return "/media/omnitroid/Data/winshare/AO/client/base/";