fix flashing issue after restore policy issue
* since commit: https://github.com/TeamWin/android_bootable_recovery/commit/a2bd7b7758a4585814f642d55301043276d8a002
after factory reset /data/recovery doesn't recreates in A-only devices.
* so fixes issue flashing newer roms need access to /data/recovery
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
Change-Id: I02cb67f7161571b1aa02784049231d42872a3587
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
diff --git a/data.cpp b/data.cpp
index 1f9498f..618fc3c 100755
--- a/data.cpp
+++ b/data.cpp
@@ -1101,6 +1101,14 @@
LOGINFO("Unable to mount '%s' to write version number.\n", Path.c_str());
return;
}
+
+ if (!TWFunc::Path_Exists(recoveryCacheDir)) {
+ LOGINFO("Recreating %s folder.\n", recoveryCacheDir.c_str());
+ if (!TWFunc::Create_Dir_Recursive(recoveryCacheDir.c_str(), S_IRWXU | S_IRWXG | S_IWGRP | S_IXGRP, 0, 0)) {
+ LOGERR("DataManager::Output_Version -- Unable to make %s: %s\n", recoveryCacheDir.c_str(), strerror(errno));
+ return;
+ }
+ }
}
std::string verPath = recoveryCacheDir + ".version";