Fixes for Add support to change TWRP Folder

Change-Id: I66a66cc6b952c1aae45c50a8f40c00febce69462
diff --git a/gui/action.cpp b/gui/action.cpp
index c48fd5d..29fa945 100755
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -2291,7 +2291,7 @@
 		gui_msg(Msg(msg::kError, "tw_folder_exists=A folder with that name already exists!"));
 	}
 
-	if (ret) ret = TWFunc::Recursive_Mkdir("\"" + newBackupFolder + "\"") ? true : false;
+	if (ret) ret = TWFunc::Recursive_Mkdir(newBackupFolder) ? true : false;
 
 
 	if (ret) {
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index f48f44d..e77d1eb 100755
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -1420,7 +1420,7 @@
 	DIR* d;
 	struct dirent* de;
 
-	if(DataManager::GetIntValue(TW_IS_ENCRYPTED)){
+	if (DataManager::GetIntValue(TW_IS_ENCRYPTED)) {
 		goto exit;
 	}
 
@@ -1435,16 +1435,16 @@
 		string fullPath = mainPath + '/' + name;
 		unsigned char type = de->d_type;
 
-		if(name == "." || name == "..") continue;
+		if (name == "." || name == "..") continue;
 
-		if(type == DT_UNKNOWN){
+		if (type == DT_UNKNOWN) {
 			type = Get_D_Type_From_Stat(fullPath);
 		}
 
-		if(type == DT_DIR && Path_Exists(fullPath + '/' + TW_SETTINGS_FILE)){
-			if('/' + name == TW_DEFAULT_RECOVERY_FOLDER){
+		if (type == DT_DIR && Path_Exists(fullPath + '/' + TW_SETTINGS_FILE)) {
+			if ('/' + name == TW_DEFAULT_RECOVERY_FOLDER) {
 				oldFolder = name;
-			}else{
+			} else {
 				customTWRPFolders.push_back(name);
 			}
 		}
@@ -1452,25 +1452,25 @@
 
 	closedir(d);
 
-	if(oldFolder == "" && customTWRPFolders.empty()){
+	if (oldFolder == "" && customTWRPFolders.empty()) {
 		LOGINFO("No recovery folder found. Using default folder.\n");
 		goto exit;
-	}else if(customTWRPFolders.empty()){
+	} else if (customTWRPFolders.empty()) {
 		LOGINFO("No custom recovery folder found. Using TWRP as default.\n");
 		goto exit;
-	}else{
-		if(customTWRPFolders.size() > 1){
+	} else {
+		if (customTWRPFolders.size() > 1) {
 			LOGINFO("More than one custom recovery folder found. Using first one from the list.\n");
-		}else{
+		} else {
 			LOGINFO("One custom recovery folder found.\n");
 		}
 		string customPath =  '/' + customTWRPFolders.at(0);
 
-		if(Path_Exists(mainPath + TW_DEFAULT_RECOVERY_FOLDER)){
+		if (Path_Exists(mainPath + TW_DEFAULT_RECOVERY_FOLDER)) {
 			string oldBackupFolder = mainPath + TW_DEFAULT_RECOVERY_FOLDER + "/BACKUPS/" + DataManager::GetStrValue("device_id");
 			string newBackupFolder = mainPath + customPath + "/BACKUPS/" + DataManager::GetStrValue("device_id");
 
-			if(Path_Exists(oldBackupFolder)){
+			if (Path_Exists(oldBackupFolder)) {
 				vector<string> backups;
 				d = opendir(oldBackupFolder.c_str());
 
@@ -1479,20 +1479,20 @@
 						string name = de->d_name;
 						unsigned char type = de->d_type;
 
-						if(name == "." || name == "..") continue;
+						if (name == "." || name == "..") continue;
 
-						if(type == DT_UNKNOWN){
+						if (type == DT_UNKNOWN) {
 							type = Get_D_Type_From_Stat(mainPath + '/' + name);
 						}
 
-						if(type == DT_DIR){
+						if (type == DT_DIR) {
 							backups.push_back(name);
 						}
 					}
 					closedir(d);
 				}
 
-				for(auto it = backups.begin(); it != backups.end(); it++){
+				for (auto it = backups.begin(); it != backups.end(); it++) {
 					Exec_Cmd("mv -f \"" + oldBackupFolder + '/' + *it + "\" \"" + newBackupFolder + '/' + *it + (Path_Exists(newBackupFolder + '/' + *it) ? "_new\"" : "\""));
 				}
 			}