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__),
|
static_cast<const char *>(__FUNCTION__),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (not exists()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return utils::retry_action([this]() -> bool {
|
return utils::retry_action([this]() -> bool {
|
||||||
try {
|
try {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
return (not exists() || ::RemoveDirectoryA(path_.c_str()));
|
return (::RemoveDirectoryA(path_.c_str()));
|
||||||
#else // !defined(_WIN32)
|
#else // !defined(_WIN32)
|
||||||
return not exists() || (rmdir(path_.c_str()) == 0);
|
return (rmdir(path_.c_str()) == 0);
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
utils::error::handle_exception(function_name, e);
|
utils::error::handle_exception(function_name, e);
|
||||||
@ -353,6 +357,10 @@ auto directory::remove_recursively() -> bool {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (not exists()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (not traverse_directory(
|
if (not traverse_directory(
|
||||||
path_,
|
path_,
|
||||||
[](auto dir_item) -> bool { return dir_item.remove_recursively(); },
|
[](auto dir_item) -> bool { return dir_item.remove_recursively(); },
|
||||||
|
@ -404,12 +404,12 @@ auto file::remove() -> bool {
|
|||||||
recur_mutex_lock lock{*mtx_};
|
recur_mutex_lock lock{*mtx_};
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
|
|
||||||
close();
|
|
||||||
|
|
||||||
if (not exists()) {
|
if (not exists()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close();
|
||||||
|
|
||||||
return utils::retry_action([this]() -> bool {
|
return utils::retry_action([this]() -> bool {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
return !!::DeleteFileA(path_.c_str());
|
return !!::DeleteFileA(path_.c_str());
|
||||||
|
@ -491,6 +491,10 @@ auto smb_directory::remove() -> bool {
|
|||||||
throw std::runtime_error("session not found|" + path_);
|
throw std::runtime_error("session not found|" + path_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (not exists()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return utils::retry_action([this]() -> bool {
|
return utils::retry_action([this]() -> bool {
|
||||||
try {
|
try {
|
||||||
auto res = smb_directory_rm(session_.get(), tid_,
|
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_);
|
throw std::runtime_error("session not found|" + path_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (not exists()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
throw std::runtime_error("failed to remove directory recursively|" + path_ +
|
throw std::runtime_error("failed to remove directory recursively|" + path_ +
|
||||||
"|not implemented");
|
"|not implemented");
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
|
@ -272,6 +272,10 @@ auto smb_file::remove() -> bool {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (not exists()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
close();
|
close();
|
||||||
|
|
||||||
return utils::retry_action([this]() -> bool {
|
return utils::retry_action([this]() -> bool {
|
||||||
|
Reference in New Issue
Block a user