Merge pull request #498 from realm/al-rmdir
Remove management directories in node
This commit is contained in:
commit
5298bff909
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue