diff options
author | Nadia Holmquist Pedersen <nadia@nhp.sh> | 2020-06-03 16:41:34 +0200 |
---|---|---|
committer | Nadia Holmquist Pedersen <nadia@nhp.sh> | 2020-06-03 16:41:34 +0200 |
commit | f9644abb67035efefcc31a894ccdd5253fd4311c (patch) | |
tree | ecf75a5509624902bf28cc3146e05e1b59e92d8c | |
parent | 23aeb5fb72069634ff3c926f778511bf4f6b1578 (diff) |
Handle open flags more correctly
-rw-r--r-- | src/frontend/qt_sdl/Platform.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/frontend/qt_sdl/Platform.cpp b/src/frontend/qt_sdl/Platform.cpp index 7621931..5199254 100644 --- a/src/frontend/qt_sdl/Platform.cpp +++ b/src/frontend/qt_sdl/Platform.cpp @@ -137,9 +137,11 @@ FILE* OpenFile(const char* path, const char* mode, bool mustexist) QIODevice::OpenMode qmode; if (strlen(mode) > 1 && mode[0] == 'r' && mode[1] == '+') { - qmode = QIODevice::OpenModeFlag::ReadWrite; - } else if (mode[0] == 'w') { - qmode = QIODevice::OpenModeFlag::Truncate; + qmode = QIODevice::OpenModeFlag::ReadWrite; + } else if (strlen(mode) > 1 && mode[0] == 'w' && mode[1] == '+') { + qmode = QIODevice::OpenModeFlag::Truncate | QIODevice::OpenModeFlag::ReadWrite; + } else if (mode[0] == 'w') { + qmode = QIODevice::OpenModeFlag::Truncate | QIODevice::OpenModeFlag::WriteOnly; } else { qmode = QIODevice::OpenModeFlag::ReadOnly; } |