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.
This commit is contained in:
parent
5ad4f3c54b
commit
c072902f23
@ -146,16 +146,6 @@ FileOutputStream::Commit()
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
FileOutputStream::Cancel() noexcept
|
|
||||||
{
|
|
||||||
assert(IsDefined());
|
|
||||||
|
|
||||||
Close();
|
|
||||||
|
|
||||||
DeleteFile(GetPath().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
@ -274,6 +264,8 @@ FileOutputStream::Commit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
FileOutputStream::Cancel() noexcept
|
FileOutputStream::Cancel() noexcept
|
||||||
{
|
{
|
||||||
@ -288,6 +280,8 @@ FileOutputStream::Cancel() noexcept
|
|||||||
#endif
|
#endif
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
unlinkat(directory_fd.Get(), GetPath().c_str(), 0);
|
unlinkat(directory_fd.Get(), GetPath().c_str(), 0);
|
||||||
|
#elif _WIN32
|
||||||
|
DeleteFile(GetPath().c_str());
|
||||||
#else
|
#else
|
||||||
unlink(GetPath().c_str());
|
unlink(GetPath().c_str());
|
||||||
#endif
|
#endif
|
||||||
@ -301,4 +295,3 @@ FileOutputStream::Cancel() noexcept
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user