mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-24 10:07:17 +01:00
Fix issue with get_current_dir()
returning the wrong path on Android
This commit is contained in:
parent
67a9002152
commit
076a1a3253
@ -138,6 +138,20 @@ String DirAccessJAndroid::get_drive(int p_drive) {
|
||||
}
|
||||
}
|
||||
|
||||
String DirAccessJAndroid::get_current_dir() {
|
||||
String base = _get_root_path();
|
||||
String bd = current_dir;
|
||||
if (base != "") {
|
||||
bd = current_dir.replace_first(base, "");
|
||||
}
|
||||
|
||||
if (bd.begins_with("/")) {
|
||||
return _get_root_string() + bd.substr(1, bd.length());
|
||||
} else {
|
||||
return _get_root_string() + bd;
|
||||
}
|
||||
}
|
||||
|
||||
Error DirAccessJAndroid::change_dir(String p_dir) {
|
||||
String new_dir = get_absolute_path(p_dir);
|
||||
if (new_dir == current_dir) {
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
virtual String get_drive(int p_drive);
|
||||
|
||||
virtual Error change_dir(String p_dir); ///< can be relative or absolute, return false on success
|
||||
virtual String get_current_dir() override; ///< return current dir location
|
||||
|
||||
virtual bool file_exists(String p_file);
|
||||
virtual bool dir_exists(String p_dir);
|
||||
|
Loading…
Reference in New Issue
Block a user