build types, untested recursive_remove function in fs

This commit is contained in:
Nicholas O'Connor
2017-03-27 21:03:35 -07:00
parent f505469ce9
commit 0adbe5e0d1
4 changed files with 29 additions and 1 deletions

View File

@@ -46,3 +46,20 @@ bool cellar::fs::recursive_copy(string src, string dst) {
return true;
}
bool cellar::fs::recursive_remove(string target) {
if (!filesystem::exists(target)) { return false; }
for (string itemrel : cellar::fs::listdir(target)) {
string itemabs = target + "/" + itemrel;
auto itemstat = filesystem::symlink_status(itemabs);
if (filesystem::is_directory(itemstat)) { recursive_remove(itemabs); }
else { filesystem::remove(itemabs); }
}
filesystem::remove(target);
return true;
}