diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-16 18:34:48 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-16 18:34:48 +0100 |
commit | ec2f9a78f7e8e9ad767a34f77ad2f825c3f59c63 (patch) | |
tree | 8b8bb867eac8b5a9cab6ede811832240b871b453 /platform/android | |
parent | 2d845ee3d1714e6d9787a061c1dc7eaba9ad4c96 (diff) | |
parent | bc95b0b17145e0e8df7e92ae5bea689112afab85 (diff) |
Merge pull request #73435 from bruvzg/file_close
Restore FileAccess.close method.
Diffstat (limited to 'platform/android')
-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(); }; |