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).
This commit is contained in:
Dees Troy
2013-10-17 00:26:23 +00:00
parent 7e176dab1b
commit a829d5deb2
+7
View File
@@ -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;
}