Set data/recovery for Settings: complementary code

After https://gerrit.twrp.me/c/android_bootable_recovery/+/5670 some functions were not working properly, such as change TWRP folder and custom themes.

Signed-off-by: Fernando Oliveira <fernandoaju78@gmail.com>
Change-Id: Ifaa777e528a6ca68e628d1719ba6d232851d338d
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 51d252a..38f59ef 100755
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -1449,7 +1449,7 @@
 			type = Get_D_Type_From_Stat(fullPath);
 		}
 
-		if (type == DT_DIR && Path_Exists(fullPath + '/' + TW_SETTINGS_FILE)) {
+		if (type == DT_DIR && Path_Exists(fullPath + "/.twrpcf")) {
 			if ('/' + name == TW_DEFAULT_RECOVERY_FOLDER) {
 				oldFolder = name;
 			} else {
@@ -1462,6 +1462,9 @@
 
 	if (oldFolder == "" && customTWRPFolders.empty()) {
 		LOGINFO("No recovery folder found. Using default folder.\n");
+		//Creates the TWRP folder if it does not exist on the device and if the folder has not been changed to a new name
+		mainPath += TW_DEFAULT_RECOVERY_FOLDER;
+		mkdir(mainPath.c_str(), 0777);
 		goto exit;
 	} else if (customTWRPFolders.empty()) {
 		LOGINFO("No custom recovery folder found. Using TWRP as default.\n");