summaryrefslogtreecommitdiffstats
path: root/platform/android/file_access_android.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2022-02-16 16:55:07 +0100
committerGitHub <noreply@github.com>2022-02-16 16:55:07 +0100
commit51a00c2855009ce4cd6475c09209ebd22641f448 (patch)
tree56b249dbe446b5e24946c16ee13bd8241a119de6 /platform/android/file_access_android.cpp
parent33c7f52f361961c64432cfd772909ed3ba76cd51 (diff)
parentb8b45804485f7ca18f035f1eeb7a1ac0cf591cac (diff)
downloadredot-engine-51a00c2855009ce4cd6475c09209ebd22641f448.tar.gz
Merge pull request #58182 from akien-mga/style-cleanup-if-semicolons-deadcode
Diffstat (limited to 'platform/android/file_access_android.cpp')
-rw-r--r--platform/android/file_access_android.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp
index 26bdcb9520..c84a919b6b 100644
--- a/platform/android/file_access_android.cpp
+++ b/platform/android/file_access_android.cpp
@@ -29,30 +29,28 @@
/*************************************************************************/
#include "file_access_android.h"
+
#include "core/string/print_string.h"
AAssetManager *FileAccessAndroid::asset_manager = nullptr;
-/*void FileAccessAndroid::make_default() {
- create_func=create_android;
-}*/
-
FileAccess *FileAccessAndroid::create_android() {
return memnew(FileAccessAndroid);
}
Error FileAccessAndroid::_open(const String &p_path, int p_mode_flags) {
String path = fix_path(p_path).simplify_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;
eof = false;
@@ -61,8 +59,9 @@ Error FileAccessAndroid::_open(const String &p_path, int p_mode_flags) {
}
void FileAccessAndroid::close() {
- if (!a)
+ if (!a) {
return;
+ }
AAsset_close(a);
a = nullptr;
}
@@ -146,15 +145,17 @@ void FileAccessAndroid::store_8(uint8_t p_dest) {
bool FileAccessAndroid::file_exists(const String &p_path) {
String path = fix_path(p_path).simplify_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());
+ }
AAsset *at = AAssetManager_open(asset_manager, path.utf8().get_data(), AASSET_MODE_STREAMING);
- if (!at)
+ if (!at) {
return false;
+ }
AAsset_close(at);
return true;