-Added a new mode, WRITE_READ to File, to recover compatibility with old projects but also achieve desired functionality. Closes #3272
This commit is contained in:
parent
4fdab4f555
commit
52e53d4513
5 changed files with 7 additions and 0 deletions
|
@ -1509,6 +1509,7 @@ void _File::_bind_methods() {
|
|||
BIND_CONSTANT( READ );
|
||||
BIND_CONSTANT( WRITE );
|
||||
BIND_CONSTANT( READ_WRITE );
|
||||
BIND_CONSTANT( WRITE_READ );
|
||||
}
|
||||
|
||||
_File::_File(){
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -78,6 +78,7 @@ public:
|
|||
READ=1,
|
||||
WRITE=2,
|
||||
READ_WRITE=3,
|
||||
WRITE_READ=7,
|
||||
};
|
||||
|
||||
virtual void close()=0; ///< close a file
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue