Remove or make private `FileAccess` `close()` methods.
This commit is contained in:
parent
788f355ad2
commit
d2ebac3a30
|
@ -88,7 +88,6 @@ public:
|
||||||
WRITE_READ = 7,
|
WRITE_READ = 7,
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void close() = 0; ///< close a file
|
|
||||||
virtual bool is_open() const = 0; ///< true when file is open
|
virtual bool is_open() const = 0; ///< true when file is open
|
||||||
|
|
||||||
virtual String get_path() const { return ""; } /// returns the path for the current open file
|
virtual String get_path() const { return ""; } /// returns the path for the current open file
|
||||||
|
|
|
@ -97,10 +97,7 @@ Error FileAccessCompressed::open_after_magic(Ref<FileAccess> p_base) {
|
||||||
|
|
||||||
Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) {
|
Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) {
|
||||||
ERR_FAIL_COND_V(p_mode_flags == READ_WRITE, ERR_UNAVAILABLE);
|
ERR_FAIL_COND_V(p_mode_flags == READ_WRITE, ERR_UNAVAILABLE);
|
||||||
|
_close();
|
||||||
if (f.is_valid()) {
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
Error err;
|
Error err;
|
||||||
f = FileAccess::open(p_path, p_mode_flags, &err);
|
f = FileAccess::open(p_path, p_mode_flags, &err);
|
||||||
|
@ -134,7 +131,7 @@ Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) {
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileAccessCompressed::close() {
|
void FileAccessCompressed::_close() {
|
||||||
if (f.is_null()) {
|
if (f.is_null()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -373,7 +370,5 @@ Error FileAccessCompressed::_set_unix_permissions(const String &p_file, uint32_t
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessCompressed::~FileAccessCompressed() {
|
FileAccessCompressed::~FileAccessCompressed() {
|
||||||
if (f.is_valid()) {
|
_close();
|
||||||
close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,13 +63,14 @@ class FileAccessCompressed : public FileAccess {
|
||||||
mutable Vector<uint8_t> buffer;
|
mutable Vector<uint8_t> buffer;
|
||||||
Ref<FileAccess> f;
|
Ref<FileAccess> f;
|
||||||
|
|
||||||
|
void _close();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void configure(const String &p_magic, Compression::Mode p_mode = Compression::MODE_ZSTD, uint32_t p_block_size = 4096);
|
void configure(const String &p_magic, Compression::Mode p_mode = Compression::MODE_ZSTD, uint32_t p_block_size = 4096);
|
||||||
|
|
||||||
Error open_after_magic(Ref<FileAccess> p_base);
|
Error open_after_magic(Ref<FileAccess> p_base);
|
||||||
|
|
||||||
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
||||||
virtual void close(); ///< close a file
|
|
||||||
virtual bool is_open() const; ///< true when file is open
|
virtual bool is_open() const; ///< true when file is open
|
||||||
|
|
||||||
virtual void seek(uint64_t p_position); ///< seek to a given position
|
virtual void seek(uint64_t p_position); ///< seek to a given position
|
||||||
|
|
|
@ -115,27 +115,11 @@ Error FileAccessEncrypted::_open(const String &p_path, int p_mode_flags) {
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileAccessEncrypted::close() {
|
void FileAccessEncrypted::_close() {
|
||||||
if (file.is_null()) {
|
if (file.is_null()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_release();
|
|
||||||
|
|
||||||
file.unref();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileAccessEncrypted::release() {
|
|
||||||
if (file.is_null()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_release();
|
|
||||||
|
|
||||||
file.unref();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileAccessEncrypted::_release() {
|
|
||||||
if (writing) {
|
if (writing) {
|
||||||
Vector<uint8_t> compressed;
|
Vector<uint8_t> compressed;
|
||||||
uint64_t len = data.size();
|
uint64_t len = data.size();
|
||||||
|
@ -173,6 +157,8 @@ void FileAccessEncrypted::_release() {
|
||||||
file->store_buffer(compressed.ptr(), compressed.size());
|
file->store_buffer(compressed.ptr(), compressed.size());
|
||||||
data.clear();
|
data.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file.unref();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileAccessEncrypted::is_open() const {
|
bool FileAccessEncrypted::is_open() const {
|
||||||
|
@ -309,7 +295,5 @@ Error FileAccessEncrypted::_set_unix_permissions(const String &p_file, uint32_t
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessEncrypted::~FileAccessEncrypted() {
|
FileAccessEncrypted::~FileAccessEncrypted() {
|
||||||
if (file.is_valid()) {
|
_close();
|
||||||
close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,15 +54,13 @@ private:
|
||||||
mutable bool eofed = false;
|
mutable bool eofed = false;
|
||||||
bool use_magic = true;
|
bool use_magic = true;
|
||||||
|
|
||||||
void _release();
|
void _close();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Error open_and_parse(Ref<FileAccess> p_base, const Vector<uint8_t> &p_key, Mode p_mode, bool p_with_magic = true);
|
Error open_and_parse(Ref<FileAccess> p_base, const Vector<uint8_t> &p_key, Mode p_mode, bool p_with_magic = true);
|
||||||
Error open_and_parse_password(Ref<FileAccess> p_base, const String &p_key, Mode p_mode);
|
Error open_and_parse_password(Ref<FileAccess> p_base, const String &p_key, Mode p_mode);
|
||||||
|
|
||||||
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
||||||
virtual void close(); ///< close a file
|
|
||||||
virtual void release(); ///< finish and keep base file open
|
|
||||||
virtual bool is_open() const; ///< true when file is open
|
virtual bool is_open() const; ///< true when file is open
|
||||||
|
|
||||||
virtual String get_path() const; /// returns the path for the current open file
|
virtual String get_path() const; /// returns the path for the current open file
|
||||||
|
|
|
@ -94,10 +94,6 @@ Error FileAccessMemory::_open(const String &p_path, int p_mode_flags) {
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileAccessMemory::close() {
|
|
||||||
data = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FileAccessMemory::is_open() const {
|
bool FileAccessMemory::is_open() const {
|
||||||
return data != nullptr;
|
return data != nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,6 @@ public:
|
||||||
|
|
||||||
virtual Error open_custom(const uint8_t *p_data, uint64_t p_len); ///< open a file
|
virtual Error open_custom(const uint8_t *p_data, uint64_t p_len); ///< open a file
|
||||||
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
||||||
virtual void close(); ///< close a file
|
|
||||||
virtual bool is_open() const; ///< true when file is open
|
virtual bool is_open() const; ///< true when file is open
|
||||||
|
|
||||||
virtual void seek(uint64_t p_position); ///< seek to a given position
|
virtual void seek(uint64_t p_position); ///< seek to a given position
|
||||||
|
|
|
@ -254,9 +254,8 @@ void FileAccessNetwork::_respond(uint64_t p_len, Error p_status) {
|
||||||
|
|
||||||
Error FileAccessNetwork::_open(const String &p_path, int p_mode_flags) {
|
Error FileAccessNetwork::_open(const String &p_path, int p_mode_flags) {
|
||||||
ERR_FAIL_COND_V(p_mode_flags != READ, ERR_UNAVAILABLE);
|
ERR_FAIL_COND_V(p_mode_flags != READ, ERR_UNAVAILABLE);
|
||||||
if (opened) {
|
_close();
|
||||||
close();
|
|
||||||
}
|
|
||||||
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
|
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
|
||||||
DEBUG_PRINT("open: " + p_path);
|
DEBUG_PRINT("open: " + p_path);
|
||||||
|
|
||||||
|
@ -287,7 +286,7 @@ Error FileAccessNetwork::_open(const String &p_path, int p_mode_flags) {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileAccessNetwork::close() {
|
void FileAccessNetwork::_close() {
|
||||||
if (!opened) {
|
if (!opened) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -483,7 +482,7 @@ FileAccessNetwork::FileAccessNetwork() {
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessNetwork::~FileAccessNetwork() {
|
FileAccessNetwork::~FileAccessNetwork() {
|
||||||
close();
|
_close();
|
||||||
|
|
||||||
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
|
FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
|
||||||
nc->lock_mutex();
|
nc->lock_mutex();
|
||||||
|
|
|
@ -113,6 +113,7 @@ class FileAccessNetwork : public FileAccess {
|
||||||
void _queue_page(int32_t p_page) const;
|
void _queue_page(int32_t p_page) const;
|
||||||
void _respond(uint64_t p_len, Error p_status);
|
void _respond(uint64_t p_len, Error p_status);
|
||||||
void _set_block(uint64_t p_offset, const Vector<uint8_t> &p_block);
|
void _set_block(uint64_t p_offset, const Vector<uint8_t> &p_block);
|
||||||
|
void _close();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Command {
|
enum Command {
|
||||||
|
@ -131,7 +132,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
||||||
virtual void close(); ///< close a file
|
|
||||||
virtual bool is_open() const; ///< true when file is open
|
virtual bool is_open() const; ///< true when file is open
|
||||||
|
|
||||||
virtual void seek(uint64_t p_position); ///< seek to a given position
|
virtual void seek(uint64_t p_position); ///< seek to a given position
|
||||||
|
|
|
@ -226,10 +226,6 @@ Error FileAccessPack::_open(const String &p_path, int p_mode_flags) {
|
||||||
return ERR_UNAVAILABLE;
|
return ERR_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileAccessPack::close() {
|
|
||||||
f.unref();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FileAccessPack::is_open() const {
|
bool FileAccessPack::is_open() const {
|
||||||
if (f.is_valid()) {
|
if (f.is_valid()) {
|
||||||
return f->is_open();
|
return f->is_open();
|
||||||
|
|
|
@ -157,7 +157,6 @@ class FileAccessPack : public FileAccess {
|
||||||
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) { return FAILED; }
|
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) { return FAILED; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void close();
|
|
||||||
virtual bool is_open() const;
|
virtual bool is_open() const;
|
||||||
|
|
||||||
virtual void seek(uint64_t p_position);
|
virtual void seek(uint64_t p_position);
|
||||||
|
|
|
@ -235,7 +235,7 @@ ZipArchive::~ZipArchive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Error FileAccessZip::_open(const String &p_path, int p_mode_flags) {
|
Error FileAccessZip::_open(const String &p_path, int p_mode_flags) {
|
||||||
close();
|
_close();
|
||||||
|
|
||||||
ERR_FAIL_COND_V(p_mode_flags & FileAccess::WRITE, FAILED);
|
ERR_FAIL_COND_V(p_mode_flags & FileAccess::WRITE, FAILED);
|
||||||
ZipArchive *arch = ZipArchive::get_singleton();
|
ZipArchive *arch = ZipArchive::get_singleton();
|
||||||
|
@ -249,7 +249,7 @@ Error FileAccessZip::_open(const String &p_path, int p_mode_flags) {
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileAccessZip::close() {
|
void FileAccessZip::_close() {
|
||||||
if (!zfile) {
|
if (!zfile) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessZip::~FileAccessZip() {
|
FileAccessZip::~FileAccessZip() {
|
||||||
close();
|
_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MINIZIP_ENABLED
|
#endif // MINIZIP_ENABLED
|
||||||
|
|
|
@ -82,9 +82,10 @@ class FileAccessZip : public FileAccess {
|
||||||
|
|
||||||
mutable bool at_eof;
|
mutable bool at_eof;
|
||||||
|
|
||||||
|
void _close();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
||||||
virtual void close(); ///< close a file
|
|
||||||
virtual bool is_open() const; ///< true when file is open
|
virtual bool is_open() const; ///< true when file is open
|
||||||
|
|
||||||
virtual void seek(uint64_t p_position); ///< seek to a given position
|
virtual void seek(uint64_t p_position); ///< seek to a given position
|
||||||
|
|
|
@ -195,7 +195,8 @@ Error PCKPacker::flush(bool p_verbose) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fae.is_valid()) {
|
if (fae.is_valid()) {
|
||||||
fae->release();
|
fhead.unref();
|
||||||
|
fae.unref();
|
||||||
}
|
}
|
||||||
|
|
||||||
int header_padding = _get_pad(alignment, file->get_position());
|
int header_padding = _get_pad(alignment, file->get_position());
|
||||||
|
@ -216,7 +217,6 @@ Error PCKPacker::flush(bool p_verbose) {
|
||||||
Ref<FileAccess> src = FileAccess::open(files[i].src_path, FileAccess::READ);
|
Ref<FileAccess> src = FileAccess::open(files[i].src_path, FileAccess::READ);
|
||||||
uint64_t to_write = files[i].size;
|
uint64_t to_write = files[i].size;
|
||||||
|
|
||||||
fae.unref();
|
|
||||||
Ref<FileAccess> ftmp = file;
|
Ref<FileAccess> ftmp = file;
|
||||||
if (files[i].encrypted) {
|
if (files[i].encrypted) {
|
||||||
fae.instantiate();
|
fae.instantiate();
|
||||||
|
@ -234,7 +234,8 @@ Error PCKPacker::flush(bool p_verbose) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fae.is_valid()) {
|
if (fae.is_valid()) {
|
||||||
fae->release();
|
ftmp.unref();
|
||||||
|
fae.unref();
|
||||||
}
|
}
|
||||||
|
|
||||||
int pad = _get_pad(alignment, file->get_position());
|
int pad = _get_pad(alignment, file->get_position());
|
||||||
|
|
|
@ -71,10 +71,7 @@ void FileAccessUnix::check_errors() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
Error FileAccessUnix::_open(const String &p_path, int p_mode_flags) {
|
Error FileAccessUnix::_open(const String &p_path, int p_mode_flags) {
|
||||||
if (f) {
|
_close();
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
f = nullptr;
|
|
||||||
|
|
||||||
path_src = p_path;
|
path_src = p_path;
|
||||||
path = fix_path(p_path);
|
path = fix_path(p_path);
|
||||||
|
@ -148,7 +145,7 @@ Error FileAccessUnix::_open(const String &p_path, int p_mode_flags) {
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileAccessUnix::close() {
|
void FileAccessUnix::_close() {
|
||||||
if (!f) {
|
if (!f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -343,7 +340,7 @@ Ref<FileAccess> FileAccessUnix::create_libc() {
|
||||||
CloseNotificationFunc FileAccessUnix::close_notification_func = nullptr;
|
CloseNotificationFunc FileAccessUnix::close_notification_func = nullptr;
|
||||||
|
|
||||||
FileAccessUnix::~FileAccessUnix() {
|
FileAccessUnix::~FileAccessUnix() {
|
||||||
close();
|
_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -50,12 +50,12 @@ class FileAccessUnix : public FileAccess {
|
||||||
String path_src;
|
String path_src;
|
||||||
|
|
||||||
static Ref<FileAccess> create_libc();
|
static Ref<FileAccess> create_libc();
|
||||||
|
void _close();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CloseNotificationFunc close_notification_func;
|
static CloseNotificationFunc close_notification_func;
|
||||||
|
|
||||||
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
||||||
virtual void close(); ///< close a file
|
|
||||||
virtual bool is_open() const; ///< true when file is open
|
virtual bool is_open() const; ///< true when file is open
|
||||||
|
|
||||||
virtual String get_path() const; /// returns the path for the current open file
|
virtual String get_path() const; /// returns the path for the current open file
|
||||||
|
|
|
@ -59,11 +59,10 @@ void FileAccessWindows::check_errors() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) {
|
Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) {
|
||||||
|
_close();
|
||||||
|
|
||||||
path_src = p_path;
|
path_src = p_path;
|
||||||
path = fix_path(p_path);
|
path = fix_path(p_path);
|
||||||
if (f) {
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
const WCHAR *mode_string;
|
const WCHAR *mode_string;
|
||||||
|
|
||||||
|
@ -134,7 +133,7 @@ Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileAccessWindows::close() {
|
void FileAccessWindows::_close() {
|
||||||
if (!f) {
|
if (!f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -350,7 +349,7 @@ Error FileAccessWindows::_set_unix_permissions(const String &p_file, uint32_t p_
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessWindows::~FileAccessWindows() {
|
FileAccessWindows::~FileAccessWindows() {
|
||||||
close();
|
_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // WINDOWS_ENABLED
|
#endif // WINDOWS_ENABLED
|
||||||
|
|
|
@ -48,9 +48,10 @@ class FileAccessWindows : public FileAccess {
|
||||||
String path_src;
|
String path_src;
|
||||||
String save_path;
|
String save_path;
|
||||||
|
|
||||||
|
void _close();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
||||||
virtual void close(); ///< close a file
|
|
||||||
virtual bool is_open() const; ///< true when file is open
|
virtual bool is_open() const; ///< true when file is open
|
||||||
|
|
||||||
virtual String get_path() const; /// returns the path for the current open file
|
virtual String get_path() const; /// returns the path for the current open file
|
||||||
|
|
|
@ -343,7 +343,8 @@ Error EditorExportPlatform::_save_pack_file(void *p_userdata, const String &p_pa
|
||||||
ftmp->store_buffer(p_data.ptr(), p_data.size());
|
ftmp->store_buffer(p_data.ptr(), p_data.size());
|
||||||
|
|
||||||
if (fae.is_valid()) {
|
if (fae.is_valid()) {
|
||||||
fae->release();
|
ftmp.unref();
|
||||||
|
fae.unref();
|
||||||
}
|
}
|
||||||
|
|
||||||
int pad = _get_pad(PCK_PADDING, pd->f->get_position());
|
int pad = _get_pad(PCK_PADDING, pd->f->get_position());
|
||||||
|
@ -1273,7 +1274,8 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, b
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fae.is_valid()) {
|
if (fae.is_valid()) {
|
||||||
fae->release();
|
fhead.unref();
|
||||||
|
fae.unref();
|
||||||
}
|
}
|
||||||
|
|
||||||
int header_padding = _get_pad(PCK_PADDING, f->get_position());
|
int header_padding = _get_pad(PCK_PADDING, f->get_position());
|
||||||
|
|
|
@ -39,6 +39,8 @@ Ref<FileAccess> FileAccessAndroid::create_android() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Error FileAccessAndroid::_open(const String &p_path, int p_mode_flags) {
|
Error FileAccessAndroid::_open(const String &p_path, int p_mode_flags) {
|
||||||
|
_close();
|
||||||
|
|
||||||
String path = fix_path(p_path).simplify_path();
|
String path = fix_path(p_path).simplify_path();
|
||||||
if (path.begins_with("/")) {
|
if (path.begins_with("/")) {
|
||||||
path = path.substr(1, path.length());
|
path = path.substr(1, path.length());
|
||||||
|
@ -58,7 +60,7 @@ Error FileAccessAndroid::_open(const String &p_path, int p_mode_flags) {
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileAccessAndroid::close() {
|
void FileAccessAndroid::_close() {
|
||||||
if (!a) {
|
if (!a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -162,5 +164,5 @@ bool FileAccessAndroid::file_exists(const String &p_path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAccessAndroid::~FileAccessAndroid() {
|
FileAccessAndroid::~FileAccessAndroid() {
|
||||||
close();
|
_close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,11 +44,12 @@ class FileAccessAndroid : public FileAccess {
|
||||||
mutable uint64_t pos = 0;
|
mutable uint64_t pos = 0;
|
||||||
mutable bool eof = false;
|
mutable bool eof = false;
|
||||||
|
|
||||||
|
void _close();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static AAssetManager *asset_manager;
|
static AAssetManager *asset_manager;
|
||||||
|
|
||||||
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
virtual Error _open(const String &p_path, int p_mode_flags); ///< open a file
|
||||||
virtual void close(); ///< close a file
|
|
||||||
virtual bool is_open() const; ///< true when file is open
|
virtual bool is_open() const; ///< true when file is open
|
||||||
|
|
||||||
virtual void seek(uint64_t p_position); ///< seek to a given position
|
virtual void seek(uint64_t p_position); ///< seek to a given position
|
||||||
|
|
Loading…
Reference in New Issue