diff options
| author | Juan Linietsky | 2016-01-10 15:15:04 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2016-01-10 15:15:04 -0300 |
| commit | 52e53d45137eb5bc667db6323c79baebb1651b5b (patch) | |
| tree | ab5420d690b459550ed9c712397c59c4bff617e8 | |
| parent | 4fdab4f555f3f7e1d3b070244d88ce18c3282a15 (diff) | |
| download | godot-52e53d45137eb5bc667db6323c79baebb1651b5b.tar.gz godot-52e53d45137eb5bc667db6323c79baebb1651b5b.tar.zst godot-52e53d45137eb5bc667db6323c79baebb1651b5b.zip | |
-Added a new mode, WRITE_READ to File, to recover compatibility with old projects but also achieve desired functionality. Closes #3272
| -rw-r--r-- | core/bind/core_bind.cpp | 1 | ||||
| -rw-r--r-- | core/bind/core_bind.h | 1 | ||||
| -rw-r--r-- | core/os/file_access.h | 1 | ||||
| -rw-r--r-- | drivers/unix/file_access_unix.cpp | 2 | ||||
| -rw-r--r-- | drivers/windows/file_access_windows.cpp | 2 |
5 files changed, 7 insertions, 0 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index f1edc3d7d..fba3e7ca0 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -1509,6 +1509,7 @@ void _File::_bind_methods() { BIND_CONSTANT( READ ); BIND_CONSTANT( WRITE ); BIND_CONSTANT( READ_WRITE ); + BIND_CONSTANT( WRITE_READ ); } _File::_File(){ diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 172f33dac..8ab887811 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -329,6 +329,7 @@ public: READ=1, WRITE=2, READ_WRITE=3, + WRITE_READ=7, }; Error open_encrypted(const String& p_path, int p_mode_flags,const Vector<uint8_t>& p_key); diff --git a/core/os/file_access.h b/core/os/file_access.h index 35514a129..51cf83911 100644 --- a/core/os/file_access.h +++ b/core/os/file_access.h @@ -78,6 +78,7 @@ public: READ=1, WRITE=2, READ_WRITE=3, + WRITE_READ=7, }; virtual void close()=0; ///< close a file diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp index 349831077..9f24633bd 100644 --- a/drivers/unix/file_access_unix.cpp +++ b/drivers/unix/file_access_unix.cpp @@ -74,6 +74,8 @@ Error FileAccessUnix::_open(const String& p_path, int p_mode_flags) { else if (p_mode_flags==WRITE) mode_string="wb"; else if (p_mode_flags==READ_WRITE) + mode_string="rb+"; + else if (p_mode_flags==WRITE_READ) mode_string="wb+"; else return ERR_INVALID_PARAMETER; diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index 818e4258b..66181a6f4 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -71,6 +71,8 @@ Error FileAccessWindows::_open(const String& p_filename, int p_mode_flags) { else if (p_mode_flags==WRITE) mode_string=L"wb"; else if (p_mode_flags==READ_WRITE) + mode_string=L"rb+"; + else if (p_mode_flags==WRITE_READ) mode_string=L"wb+"; else return ERR_INVALID_PARAMETER; |
