diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-02-16 15:25:32 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-02-16 15:34:20 +0200 |
commit | bc95b0b17145e0e8df7e92ae5bea689112afab85 (patch) | |
tree | 3f8b1b171d14032e7508108caa50bdda44398d5d /platform | |
parent | 953383328af17e8c9fd6359285c12617cb22f636 (diff) |
Restore FileAccess.close method.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/file_access_android.cpp | 4 | ||||
-rw-r--r-- | platform/android/file_access_android.h | 2 | ||||
-rw-r--r-- | platform/android/file_access_filesystem_jandroid.cpp | 6 | ||||
-rw-r--r-- | platform/android/file_access_filesystem_jandroid.h | 2 |
4 files changed, 14 insertions, 0 deletions
diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp index 5df05580a5..1249f2219f 100644 --- a/platform/android/file_access_android.cpp +++ b/platform/android/file_access_android.cpp @@ -169,6 +169,10 @@ bool FileAccessAndroid::file_exists(const String &p_path) { return true; } +void FileAccessAndroid::close() { + _close(); +} + FileAccessAndroid::~FileAccessAndroid() { _close(); } diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h index 1d25a28d90..b8f45628e5 100644 --- a/platform/android/file_access_android.h +++ b/platform/android/file_access_android.h @@ -78,6 +78,8 @@ public: virtual uint32_t _get_unix_permissions(const String &p_file) override { return 0; } virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) override { return FAILED; } + virtual void close() override; + ~FileAccessAndroid(); }; diff --git a/platform/android/file_access_filesystem_jandroid.cpp b/platform/android/file_access_filesystem_jandroid.cpp index 7174d57344..ea8459d1ed 100644 --- a/platform/android/file_access_filesystem_jandroid.cpp +++ b/platform/android/file_access_filesystem_jandroid.cpp @@ -333,6 +333,12 @@ void FileAccessFilesystemJAndroid::setup(jobject p_file_access_handler) { _file_last_modified = env->GetMethodID(cls, "fileLastModified", "(Ljava/lang/String;)J"); } +void FileAccessFilesystemJAndroid::close() { + if (is_open()) { + _close(); + } +} + FileAccessFilesystemJAndroid::FileAccessFilesystemJAndroid() { id = 0; } diff --git a/platform/android/file_access_filesystem_jandroid.h b/platform/android/file_access_filesystem_jandroid.h index 7829ab7cf9..5e74d9de24 100644 --- a/platform/android/file_access_filesystem_jandroid.h +++ b/platform/android/file_access_filesystem_jandroid.h @@ -93,6 +93,8 @@ public: virtual uint32_t _get_unix_permissions(const String &p_file) override { return 0; } virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) override { return FAILED; } + virtual void close() override; + FileAccessFilesystemJAndroid(); ~FileAccessFilesystemJAndroid(); }; |