We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 556352d commit 9c12efdCopy full SHA for 9c12efd
src/util/file_util.cpp
@@ -16,6 +16,7 @@ Date: January 2012
16
defined(__unix__) || \
17
defined(__CYGWIN__) || \
18
defined(__MACH__)
19
+#include <sys/stat.h>
20
#include <unistd.h>
21
#include <dirent.h>
22
#include <cstdlib>
@@ -124,8 +125,13 @@ void delete_directory(const std::string &path)
124
125
// Needed for Alpine Linux
126
if(strcmp(ent->d_name, ".")==0 || strcmp(ent->d_name, "..")==0)
127
continue;
128
+
129
std::string sub_path=path+"/"+ent->d_name;
- if(ent->d_type==DT_DIR)
130
131
+ struct stat stbuf;
132
+ stat(sub_path.c_str(), &stbuf);
133
134
+ if(S_ISDIR(stbuf.st_mode))
135
delete_directory(sub_path);
136
else
137
remove(sub_path.c_str());
0 commit comments