refactor
This commit is contained in:
@@ -161,7 +161,7 @@ auto directory::create_directory(std::string_view path) const
|
||||
std::string{abs_path} + '|' +
|
||||
std::to_string(res));
|
||||
}
|
||||
#else // !defined(_WIN32)
|
||||
#else // !defined(_WIN32)
|
||||
auto ret{true};
|
||||
auto paths =
|
||||
utils::string::split(abs_path, utils::path::directory_seperator, false);
|
||||
@@ -377,10 +377,16 @@ auto directory::remove() -> bool {
|
||||
return utils::retry_action([this]() -> bool {
|
||||
try {
|
||||
#if defined(_WIN32)
|
||||
return not exists() || (::RemoveDirectoryA(path_.c_str()) != 0);
|
||||
auto ret = not exists() || (::RemoveDirectoryA(path_.c_str()) != 0);
|
||||
#else // !defined(_WIN32)
|
||||
return not exists() || (rmdir(path_.c_str()) == 0);
|
||||
auto ret = not exists() || (rmdir(path_.c_str()) == 0);
|
||||
#endif // defined(_WIN32)
|
||||
if (not ret) {
|
||||
utils::error::handle_error(function_name,
|
||||
"failed to remove directory|" + path_);
|
||||
}
|
||||
|
||||
return ret;
|
||||
} catch (const std::exception &e) {
|
||||
utils::error::handle_exception(function_name, e);
|
||||
} catch (...) {
|
||||
|
||||
Reference in New Issue
Block a user