mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Recursively deleting directories during state sync. (#189)
This commit is contained in:
@@ -314,6 +314,19 @@ namespace util
|
||||
1, FTW_PHYS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a directory recursively with it's content. FTW_DEPTH is provided so all of the files and subdirectories within
|
||||
* The path will be processed. FTW_PHYS is provided so symbolic links won't be followed.
|
||||
*/
|
||||
int remove_directory_recursively(std::string_view dir_path)
|
||||
{
|
||||
return nftw(
|
||||
dir_path.data(), [](const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf) {
|
||||
return remove(fpath);
|
||||
},
|
||||
1, FTW_DEPTH | FTW_PHYS);
|
||||
}
|
||||
|
||||
void split_string(std::vector<std::string> &collection, std::string_view str, std::string_view delimeter)
|
||||
{
|
||||
if (str.empty())
|
||||
|
||||
Reference in New Issue
Block a user