You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Additional fixes to the Android get_current_dir() implementation.
(cherry picked from commit 9910d4681d)
This commit is contained in:
committed by
Rémi Verschelde
parent
8219a72574
commit
e1e03297f1
@@ -134,6 +134,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() {
|
||||
String base = _get_root_path();
|
||||
String bd = current_dir;
|
||||
@@ -141,10 +148,13 @@ String DirAccessJAndroid::get_current_dir() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user