Merge pull request #498 from realm/al-rmdir

Remove management directories in node
This commit is contained in:
Ari Lazier 2016-06-20 12:04:31 -07:00 committed by GitHub
commit 5298bff909
1 changed files with 3 additions and 14 deletions

View File

@ -19,7 +19,7 @@
#include <dirent.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <system_error>
@ -58,19 +58,8 @@ void copy_bundled_realm_files()
void remove_realm_files_from_directory(const std::string &dir_path)
{
DIR *dir = opendir(dir_path.c_str());
if (!dir) {
return;
}
while (struct dirent *entry = readdir(dir)) {
if (strstr(entry->d_name, ".realm")) {
// Intentionally not complaining if there was an error.
unlink(entry->d_name);
}
}
closedir(dir);
std::string delete_realms = "rm -rf '" + dir_path + "'/*.realm*";
system(delete_realms.c_str());
}
} // realm