From c072902f23ef987d8ef344b126ebb42b12a8fd4a Mon Sep 17 00:00:00 2001 From: Philipp Wollschlegel Date: Tue, 23 Nov 2021 22:40:38 +0100 Subject: [PATCH] io/FileOutputStream: merge win32 function Cancel Win32 had a separate implementation for FileOutputStream::CANCEL Logic was added to the other platform function, but forgotten in this one. This merges the functions into one, as only the call for file deletion is platform specific. --- src/io/FileOutputStream.cxx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/io/FileOutputStream.cxx b/src/io/FileOutputStream.cxx index c8e96189d..0cbd54284 100644 --- a/src/io/FileOutputStream.cxx +++ b/src/io/FileOutputStream.cxx @@ -146,16 +146,6 @@ FileOutputStream::Commit() Close(); } -void -FileOutputStream::Cancel() noexcept -{ - assert(IsDefined()); - - Close(); - - DeleteFile(GetPath().c_str()); -} - #else #include @@ -274,6 +264,8 @@ FileOutputStream::Commit() } } +#endif + void FileOutputStream::Cancel() noexcept { @@ -288,6 +280,8 @@ FileOutputStream::Cancel() noexcept #endif #ifdef __linux__ unlinkat(directory_fd.Get(), GetPath().c_str(), 0); +#elif _WIN32 + DeleteFile(GetPath().c_str()); #else unlink(GetPath().c_str()); #endif @@ -301,4 +295,3 @@ FileOutputStream::Cancel() noexcept } } -#endif