mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-13 14:21:11 +01:00
Small improvements to the android platform.
This commit is contained in:
parent
379a669f65
commit
e8625c21fe
@ -148,7 +148,7 @@ String DirAccessJAndroid::_get_root_string() const {
|
||||
String DirAccessJAndroid::get_current_dir() {
|
||||
String base = _get_root_path();
|
||||
String bd = current_dir;
|
||||
if (base != "") {
|
||||
if (!base.empty()) {
|
||||
bd = current_dir.replace_first(base, "");
|
||||
}
|
||||
|
||||
|
@ -43,17 +43,23 @@ String FileAccessAndroid::get_path_absolute() const {
|
||||
|
||||
Error FileAccessAndroid::_open(const String &p_path, int p_mode_flags) {
|
||||
path_src = p_path;
|
||||
|
||||
String path = fix_path(p_path).simplify_path();
|
||||
absolute_path = path;
|
||||
if (path.begins_with("/"))
|
||||
|
||||
if (path.begins_with("/")) {
|
||||
path = path.substr(1, path.length());
|
||||
else if (path.begins_with("res://"))
|
||||
} else if (path.begins_with("res://")) {
|
||||
path = path.substr(6, path.length());
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(p_mode_flags & FileAccess::WRITE, ERR_UNAVAILABLE); //can't write on android..
|
||||
a = AAssetManager_open(asset_manager, path.utf8().get_data(), AASSET_MODE_STREAMING);
|
||||
if (!a)
|
||||
|
||||
if (!a) {
|
||||
return ERR_CANT_OPEN;
|
||||
}
|
||||
|
||||
//ERR_FAIL_COND_V(!a,ERR_FILE_NOT_FOUND);
|
||||
len = AAsset_getLength(a);
|
||||
pos = 0;
|
||||
@ -63,8 +69,10 @@ Error FileAccessAndroid::_open(const String &p_path, int p_mode_flags) {
|
||||
}
|
||||
|
||||
void FileAccessAndroid::close() {
|
||||
if (!a)
|
||||
if (!a) {
|
||||
return;
|
||||
}
|
||||
|
||||
AAsset_close(a);
|
||||
a = NULL;
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ class FileAccessHandler(val context: Context) {
|
||||
|
||||
fun fileOpen(path: String?, modeFlags: Int): Int {
|
||||
val storageScope = storageScopeIdentifier.identifyStorageScope(path)
|
||||
|
||||
if (storageScope == StorageScope.UNKNOWN) {
|
||||
return INVALID_FILE_ID
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user