mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-14 06:41:10 +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 DirAccessJAndroid::get_current_dir() {
|
||||||
String base = _get_root_path();
|
String base = _get_root_path();
|
||||||
String bd = current_dir;
|
String bd = current_dir;
|
||||||
if (base != "") {
|
if (!base.empty()) {
|
||||||
bd = current_dir.replace_first(base, "");
|
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) {
|
Error FileAccessAndroid::_open(const String &p_path, int p_mode_flags) {
|
||||||
path_src = p_path;
|
path_src = p_path;
|
||||||
|
|
||||||
String path = fix_path(p_path).simplify_path();
|
String path = fix_path(p_path).simplify_path();
|
||||||
absolute_path = path;
|
absolute_path = path;
|
||||||
if (path.begins_with("/"))
|
|
||||||
|
if (path.begins_with("/")) {
|
||||||
path = path.substr(1, path.length());
|
path = path.substr(1, path.length());
|
||||||
else if (path.begins_with("res://"))
|
} else if (path.begins_with("res://")) {
|
||||||
path = path.substr(6, path.length());
|
path = path.substr(6, path.length());
|
||||||
|
}
|
||||||
|
|
||||||
ERR_FAIL_COND_V(p_mode_flags & FileAccess::WRITE, ERR_UNAVAILABLE); //can't write on android..
|
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);
|
a = AAssetManager_open(asset_manager, path.utf8().get_data(), AASSET_MODE_STREAMING);
|
||||||
if (!a)
|
|
||||||
|
if (!a) {
|
||||||
return ERR_CANT_OPEN;
|
return ERR_CANT_OPEN;
|
||||||
|
}
|
||||||
|
|
||||||
//ERR_FAIL_COND_V(!a,ERR_FILE_NOT_FOUND);
|
//ERR_FAIL_COND_V(!a,ERR_FILE_NOT_FOUND);
|
||||||
len = AAsset_getLength(a);
|
len = AAsset_getLength(a);
|
||||||
pos = 0;
|
pos = 0;
|
||||||
@ -63,8 +69,10 @@ Error FileAccessAndroid::_open(const String &p_path, int p_mode_flags) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FileAccessAndroid::close() {
|
void FileAccessAndroid::close() {
|
||||||
if (!a)
|
if (!a) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AAsset_close(a);
|
AAsset_close(a);
|
||||||
a = NULL;
|
a = NULL;
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,7 @@ class FileAccessHandler(val context: Context) {
|
|||||||
|
|
||||||
fun fileOpen(path: String?, modeFlags: Int): Int {
|
fun fileOpen(path: String?, modeFlags: Int): Int {
|
||||||
val storageScope = storageScopeIdentifier.identifyStorageScope(path)
|
val storageScope = storageScopeIdentifier.identifyStorageScope(path)
|
||||||
|
|
||||||
if (storageScope == StorageScope.UNKNOWN) {
|
if (storageScope == StorageScope.UNKNOWN) {
|
||||||
return INVALID_FILE_ID
|
return INVALID_FILE_ID
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user