mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 03:46:50 +01:00
Additional fixes to the Android get_current_dir()
implementation.
This commit is contained in:
parent
6a317fbe15
commit
a6a5b60235
@ -53,7 +53,7 @@ private:
|
||||
|
||||
protected:
|
||||
String _get_root_path() const;
|
||||
String _get_root_string() const;
|
||||
virtual String _get_root_string() const;
|
||||
|
||||
AccessType get_access_type() const;
|
||||
String fix_path(String p_path) const;
|
||||
|
@ -138,6 +138,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;
|
||||
@ -145,10 +152,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,9 @@ public:
|
||||
DirAccessJAndroid();
|
||||
~DirAccessJAndroid();
|
||||
|
||||
protected:
|
||||
String _get_root_string() const override;
|
||||
|
||||
private:
|
||||
int id;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user