diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/fs/io/FileOutputStream.cxx | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/src/fs/io/FileOutputStream.cxx b/src/fs/io/FileOutputStream.cxx index 265594c26..a4ef8f6b4 100644 --- a/src/fs/io/FileOutputStream.cxx +++ b/src/fs/io/FileOutputStream.cxx @@ -214,32 +214,16 @@ FileOutputStream::Cancel() RemoveFile(GetPath()); } -#ifdef WIN32 - -FileOutputStream::FileOutputStream(Path _path, Error &error) - :path(_path), - handle(CreateFile(path.c_str(), GENERIC_WRITE, 0, nullptr, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL|FILE_FLAG_WRITE_THROUGH, - nullptr)) -{ - if (handle == INVALID_HANDLE_VALUE) { - const auto path_utf8 = path.ToUTF8(); - error.FormatLastError("Failed to create %s", - path_utf8.c_str()); - } -} - -#else +#endif AppendFileOutputStream::AppendFileOutputStream(Path _path, Error &error) :BaseFileOutputStream(_path) { #ifdef WIN32 - SetHandle(CreateFile(path.c_str(), GENERIC_WRITE, 0, nullptr, + SetHandle(CreateFile(GetPath().c_str(), GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_WRITE_THROUGH, - nullptr)) + nullptr)); if (!IsDefined()) error.FormatLastError("Failed to append to %s", GetPath().ToUTF8().c_str()); @@ -257,8 +241,6 @@ AppendFileOutputStream::AppendFileOutputStream(Path _path, Error &error) #endif } -#endif - bool AppendFileOutputStream::Commit(gcc_unused Error &error) { @@ -274,5 +256,3 @@ AppendFileOutputStream::Commit(gcc_unused Error &error) return success; #endif } - -#endif |