From ae60825b2997a9c6ceee37483b5d5a15c99214ee Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Tue, 18 Apr 2017 00:53:53 +0200 Subject: [PATCH] debugging help, fastter loading(?) and android sdcard --- android/AndroidManifest.xml | 12 ++++++------ path_functions.cpp | 20 +++++++++++++++----- text_file_functions.cpp | 4 +++- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 73d5c2c..f458c6a 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,7 +1,7 @@ - - - + + + @@ -11,7 +11,7 @@ - + @@ -63,12 +63,12 @@ - + - + diff --git a/path_functions.cpp b/path_functions.cpp index e9476d5..c415fa0 100644 --- a/path_functions.cpp +++ b/path_functions.cpp @@ -3,22 +3,32 @@ #include "file_functions.h" #include #include +#include #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/"; diff --git a/text_file_functions.cpp b/text_file_functions.cpp index fc75eab..e4bc2a1 100644 --- a/text_file_functions.cpp +++ b/text_file_functions.cpp @@ -152,8 +152,10 @@ QString AOApplication::read_design_ini(QString p_identifier, QString p_design_pa design_ini.setFileName(p_design_path); if (!design_ini.open(QIODevice::ReadOnly)) + { + qDebug() << "Could not find design ini " + p_design_path; return ""; - + } QTextStream in(&design_ini); QString result = "";