From 4145aa5c05c4c97c66a715acbdb2ca241b9cd6cc Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 19 Jun 2000 08:09:51 +0000 Subject: [PATCH] forgotten fix for write_append and non existing file git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7597 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/file.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/common/file.cpp b/src/common/file.cpp index 54d431e42d..cd4f7c7a01 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -216,14 +216,19 @@ bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode) flags |= O_RDONLY; break; + case write_append: + if ( wxFile::Exists(szFileName) ) + { + flags |= O_WRONLY | O_APPEND; + break; + } + //else: fall through as write_append is the same as write if the + // file doesn't exist + case write: flags |= O_WRONLY | O_CREAT | O_TRUNC; break; - case write_append: - flags |= O_WRONLY | O_CREAT | O_APPEND; - break; - case read_write: flags |= O_RDWR; break;