summaryrefslogtreecommitdiffstats
path: root/twrp-functions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'twrp-functions.cpp')
-rw-r--r--twrp-functions.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 96114241f..b51024cf1 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -54,6 +54,7 @@
extern "C" {
#include "libcrecovery/common.h"
+ #include "set_metadata.h"
}
/* Execute a command */
@@ -406,9 +407,13 @@ int TWFunc::Recursive_Mkdir(string Path) {
while (pos != string::npos)
{
wholePath = pathCpy.substr(0, pos);
- if (mkdir(wholePath.c_str(), 0777) && errno != EEXIST) {
- LOGERR("Unable to create folder: %s (errno=%d)\n", wholePath.c_str(), errno);
- return false;
+ if (!TWFunc::Path_Exists(wholePath)) {
+ if (mkdir(wholePath.c_str(), 0777)) {
+ LOGERR("Unable to create folder: %s (errno=%d)\n", wholePath.c_str(), errno);
+ return false;
+ } else {
+ tw_set_default_metadata(wholePath.c_str());
+ }
}
pos = pathCpy.find("/", pos + 1);