mirror of
https://github.com/alicealys/t5-gsc-utils.git
synced 2025-10-26 23:36:56 +00:00
Support std::filesystem::path
This commit is contained in:
@@ -120,4 +120,16 @@ namespace utils::io
|
||||
{
|
||||
std::filesystem::copy(src, target, std::filesystem::copy_options::overwrite_existing | std::filesystem::copy_options::recursive);
|
||||
}
|
||||
}
|
||||
|
||||
size_t remove_directory(const std::filesystem::path& src, bool recursive)
|
||||
{
|
||||
if (recursive)
|
||||
{
|
||||
return static_cast<size_t>(std::filesystem::remove_all(src));
|
||||
}
|
||||
else
|
||||
{
|
||||
return static_cast<size_t>(std::filesystem::remove(src));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,4 +18,5 @@ namespace utils::io
|
||||
bool directory_is_empty(const std::string& directory);
|
||||
std::vector<std::string> list_files(const std::string& directory);
|
||||
void copy_folder(const std::filesystem::path& src, const std::filesystem::path& target);
|
||||
size_t remove_directory(const std::filesystem::path& src, bool recursive = false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user