From a829d5deb2764a0f11bd21f84a45d2f5d12aff15 Mon Sep 17 00:00:00 2001 From: Dees Troy Date: Thu, 17 Oct 2013 00:26:23 +0000 Subject: Remove trailing spaces on auto generated backup names Trailing spaces sometimes cause folder creation depending on what file system is in use (e.g. vfat). --- twrp-functions.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/twrp-functions.cpp b/twrp-functions.cpp index c39a6b242..1c0ad7590 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -1016,6 +1016,13 @@ void TWFunc::Auto_Generate_Backup_Name() { Backup_Name += " " + propvalue; if (Backup_Name.size() > MAX_BACKUP_NAME_LEN) Backup_Name.resize(MAX_BACKUP_NAME_LEN); + // Trailing spaces cause problems on some file systems, so remove them + string space_check, space = " "; + space_check = Backup_Name.substr(Backup_Name.size() - 1, 1); + while (space_check == space) { + Backup_Name.resize(Backup_Name.size() - 1); + space_check = Backup_Name.substr(Backup_Name.size() - 1, 1); + } DataManager::SetValue(TW_BACKUP_NAME, Backup_Name); break; } -- cgit v1.2.3