summaryrefslogtreecommitdiff
path: root/platform/android/dir_access_jandroid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/dir_access_jandroid.cpp')
-rw-r--r--platform/android/dir_access_jandroid.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index 428135de56..4f1ac16975 100644
--- a/platform/android/dir_access_jandroid.cpp
+++ b/platform/android/dir_access_jandroid.cpp
@@ -135,6 +135,13 @@ String DirAccessJAndroid::get_drive(int p_drive) {
}
}
+String DirAccessJAndroid::_get_root_string() const {
+ if (get_access_type() == ACCESS_FILESYSTEM) {
+ return "/";
+ }
+ return DirAccessUnix::_get_root_string();
+}
+
String DirAccessJAndroid::get_current_dir(bool p_include_drive) const {
String base = _get_root_path();
String bd = current_dir;
@@ -142,10 +149,13 @@ String DirAccessJAndroid::get_current_dir(bool p_include_drive) const {
bd = current_dir.replace_first(base, "");
}
- if (bd.begins_with("/")) {
- return _get_root_string() + bd.substr(1, bd.length());
+ String root_string = _get_root_string();
+ if (bd.begins_with(root_string)) {
+ return bd;
+ } else if (bd.begins_with("/")) {
+ return root_string + bd.substr(1, bd.length());
} else {
- return _get_root_string() + bd;
+ return root_string + bd;
}
}
@@ -169,7 +179,7 @@ String DirAccessJAndroid::get_absolute_path(String p_path) {
}
if (p_path.is_relative_path()) {
- p_path = get_current_dir().plus_file(p_path);
+ p_path = get_current_dir().path_join(p_path);
}
p_path = fix_path(p_path);