From d949e730f4078335d0e48e591c05a92057f1c5f4 Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Wed, 17 Nov 2021 09:31:55 +0100 Subject: Corrected flags to open() so behaviour matches Windows' CREATE_ALWAYS --- zencore/filesystem.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'zencore/filesystem.cpp') diff --git a/zencore/filesystem.cpp b/zencore/filesystem.cpp index 4456757a6..a4c81f6cc 100644 --- a/zencore/filesystem.cpp +++ b/zencore/filesystem.cpp @@ -545,11 +545,12 @@ WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t Buffer } #else - int Fd = open(Path.c_str(), O_WRONLY); + int OpenFlags = O_WRONLY|O_CREAT|O_TRUNC; + int Fd = open(Path.c_str(), OpenFlags); if (Fd < 0) { zen::CreateDirectories(Path.parent_path()); - Fd = open(Path.c_str(), O_WRONLY); + Fd = open(Path.c_str(), OpenFlags); } if (Fd < 0) -- cgit v1.2.3