fixes
This commit is contained in:
@@ -397,18 +397,14 @@ auto file::sha256() -> std::optional<std::string> {
|
||||
#endif // defined(PROJECT_ENABLE_LIBSODIUM)
|
||||
|
||||
auto file::remove() -> bool {
|
||||
if (not exists()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
close();
|
||||
|
||||
return utils::retry_action([this]() -> bool {
|
||||
#if defined(_WIN32)
|
||||
return ::DeleteFileA(path_.c_str()) != 0;
|
||||
return not exists() || (::DeleteFileA(path_.c_str()) != 0);
|
||||
#else // !defined(_WIN32)
|
||||
std::error_code ec{};
|
||||
return std::filesystem::remove(path_, ec);
|
||||
return not exists() || std::filesystem::remove(path_, ec);
|
||||
#endif // defined(_WIN32)
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user