From d4b22b0f4f7e1c74996d6a97575760f62d83e3a9 Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Fri, 18 Jan 2013 17:17:58 +0000 Subject: Move backup folder creation to after free space calc Also fix free space calculation --- partitionmanager.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/partitionmanager.cpp b/partitionmanager.cpp index 8235a291f..c39a7d10d 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -640,13 +640,6 @@ int TWPartitionManager::Run_Backup(void) { Full_Backup_Path = Backup_Folder + "/" + Backup_Name + "/"; LOGI("Full_Backup_Path is: '%s'\n", Full_Backup_Path.c_str()); - ui_print("\n[BACKUP STARTED]\n"); - ui_print(" * Backup Folder: %s\n", Full_Backup_Path.c_str()); - if (!TWFunc::Recursive_Mkdir(Full_Backup_Path)) { - LOGE("Failed to make backup folder.\n"); - return false; - } - LOGI("Calculating backup details...\n"); DataManager::GetValue(TW_BACKUP_SYSTEM_VAR, check); if (check) { @@ -817,7 +810,7 @@ int TWPartitionManager::Run_Backup(void) { LOGE("Unable to locate storage device.\n"); return false; } - if (free_space + (32 * 1024 * 1024) < total_bytes) { + if (free_space - (32 * 1024 * 1024) < total_bytes) { // We require an extra 32MB just in case LOGE("Not enough free space on storage.\n"); return false; @@ -825,6 +818,13 @@ int TWPartitionManager::Run_Backup(void) { img_bytes_remaining = img_bytes; file_bytes_remaining = file_bytes; + ui_print("\n[BACKUP STARTED]\n"); + ui_print(" * Backup Folder: %s\n", Full_Backup_Path.c_str()); + if (!TWFunc::Recursive_Mkdir(Full_Backup_Path)) { + LOGE("Failed to make backup folder.\n"); + return false; + } + ui->SetProgress(0.0); if (!Backup_Partition(backup_sys, Full_Backup_Path, do_md5, &img_bytes_remaining, &file_bytes_remaining, &img_time, &file_time, &img_bytes, &file_bytes)) -- cgit v1.2.3