mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
open_read_write should work for files that don't yet exist too
This commit is contained in:
parent
5fd9b15b02
commit
f474d2a336
@ -1349,14 +1349,20 @@ open_append(ofstream &stream) const {
|
|||||||
// false otherwise. This requires the setting of the
|
// false otherwise. This requires the setting of the
|
||||||
// set_text()/set_binary() flags to open the file
|
// set_text()/set_binary() flags to open the file
|
||||||
// appropriately as indicated; it is an error to call
|
// appropriately as indicated; it is an error to call
|
||||||
// open_read() without first calling one of set_text()
|
// open_read_write() without first calling one of
|
||||||
// or set_binary().
|
// set_text() or set_binary().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool Filename::
|
bool Filename::
|
||||||
open_read_write(fstream &stream) const {
|
open_read_write(fstream &stream) const {
|
||||||
assert(is_text() || is_binary());
|
assert(is_text() || is_binary());
|
||||||
|
|
||||||
ios_openmode open_mode = ios::in | ios::out;
|
ios_openmode open_mode = ios::out | ios::in;
|
||||||
|
|
||||||
|
// Since ios::in also seems to imply ios::nocreate (!), we must
|
||||||
|
// guarantee the file already exists before we try to open it.
|
||||||
|
if (!exists()) {
|
||||||
|
touch();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_IOS_BINARY
|
#ifdef HAVE_IOS_BINARY
|
||||||
// For some reason, some systems (like Irix) don't define
|
// For some reason, some systems (like Irix) don't define
|
||||||
|
Loading…
x
Reference in New Issue
Block a user