remove management directories in node

This commit is contained in:
Ari Lazier 2016-06-20 10:49:53 -07:00
parent a78f2270ae
commit 5eb64025f9
1 changed files with 6 additions and 1 deletions

View File

@ -66,7 +66,12 @@ void remove_realm_files_from_directory(const std::string &dir_path)
while (struct dirent *entry = readdir(dir)) {
if (strstr(entry->d_name, ".realm")) {
// Intentionally not complaining if there was an error.
unlink(entry->d_name);
if (entry->d_type == DT_DIR) {
rmdir(entry->d_name);
}
else {
unlink(entry->d_name);
}
}
}