updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
@ -330,12 +330,16 @@ auto directory::remove() -> bool {
|
||||
static_cast<const char *>(__FUNCTION__),
|
||||
};
|
||||
|
||||
if (not exists()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return utils::retry_action([this]() -> bool {
|
||||
try {
|
||||
#if defined(_WIN32)
|
||||
return (not exists() || ::RemoveDirectoryA(path_.c_str()));
|
||||
return (::RemoveDirectoryA(path_.c_str()));
|
||||
#else // !defined(_WIN32)
|
||||
return not exists() || (rmdir(path_.c_str()) == 0);
|
||||
return (rmdir(path_.c_str()) == 0);
|
||||
#endif // defined(_WIN32)
|
||||
} catch (const std::exception &e) {
|
||||
utils::error::handle_exception(function_name, e);
|
||||
@ -353,6 +357,10 @@ auto directory::remove_recursively() -> bool {
|
||||
};
|
||||
|
||||
try {
|
||||
if (not exists()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (not traverse_directory(
|
||||
path_,
|
||||
[](auto dir_item) -> bool { return dir_item.remove_recursively(); },
|
||||
|
@ -404,12 +404,12 @@ auto file::remove() -> bool {
|
||||
recur_mutex_lock lock{*mtx_};
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
close();
|
||||
|
||||
if (not exists()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
close();
|
||||
|
||||
return utils::retry_action([this]() -> bool {
|
||||
#if defined(_WIN32)
|
||||
return !!::DeleteFileA(path_.c_str());
|
||||
|
@ -491,6 +491,10 @@ auto smb_directory::remove() -> bool {
|
||||
throw std::runtime_error("session not found|" + path_);
|
||||
}
|
||||
|
||||
if (not exists()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return utils::retry_action([this]() -> bool {
|
||||
try {
|
||||
auto res = smb_directory_rm(session_.get(), tid_,
|
||||
@ -528,6 +532,10 @@ auto smb_directory::remove_recursively() -> bool {
|
||||
throw std::runtime_error("session not found|" + path_);
|
||||
}
|
||||
|
||||
if (not exists()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
throw std::runtime_error("failed to remove directory recursively|" + path_ +
|
||||
"|not implemented");
|
||||
} catch (const std::exception &e) {
|
||||
|
@ -272,6 +272,10 @@ auto smb_file::remove() -> bool {
|
||||
};
|
||||
|
||||
try {
|
||||
if (not exists()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
close();
|
||||
|
||||
return utils::retry_action([this]() -> bool {
|
||||
|
Reference in New Issue
Block a user