From e0a433a94dd82d7754757efcc50f294de50bf185 Mon Sep 17 00:00:00 2001 From: Dees Troy Date: Mon, 2 Dec 2013 04:10:37 +0000 Subject: Refactor twrpTar to use TarList Eliminate the use of tarDirs and Generate_MultipleArcives in favor of Generate_TarList so that we have one method for backup creation instead of three. Change-Id: I267937b6e40b32d43fbac8b4cca82f7468d4f94c --- partition.cpp | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) (limited to 'partition.cpp') diff --git a/partition.cpp b/partition.cpp index aeef04ea4..541289a0b 100644 --- a/partition.cpp +++ b/partition.cpp @@ -1596,34 +1596,17 @@ bool TWPartition::Backup_Tar(string backup_folder) { Backup_FileName = back_name; Full_FileName = backup_folder + "/" + Backup_FileName; tar.has_data_media = Has_Data_Media; - if (!use_encryption && Backup_Size > MAX_ARCHIVE_SIZE) { - // This backup needs to be split into multiple archives - gui_print("Breaking backup file into multiple archives...\n"); - sprintf(back_name, "%s", Backup_Path.c_str()); - tar.setdir(back_name); - tar.setfn(Full_FileName); - backup_count = tar.splitArchiveFork(); - if (backup_count == -1) { - LOGERR("Error tarring split files!\n"); - return false; - } - return true; - } else { - Full_FileName = backup_folder + "/" + Backup_FileName; - tar.setdir(Backup_Path); - tar.setfn(Full_FileName); - if (tar.createTarFork() != 0) - return false; - if (use_compression && !use_encryption) { - string gzname = Full_FileName + ".gz"; - rename(gzname.c_str(), Full_FileName.c_str()); - } - if (use_encryption) - Full_FileName += "000"; - if (TWFunc::Get_File_Size(Full_FileName) == 0) { - LOGERR("Backup file size for '%s' is 0 bytes.\n", Full_FileName.c_str()); - return false; - } + Full_FileName = backup_folder + "/" + Backup_FileName; + tar.setdir(Backup_Path); + tar.setfn(Full_FileName); + tar.setsize(Backup_Size); + if (tar.createTarFork() != 0) + return false; + if (use_encryption) + Full_FileName += "000"; + if (TWFunc::Get_File_Size(Full_FileName) == 0) { + LOGERR("Backup file size for '%s' is 0 bytes.\n", Full_FileName.c_str()); + return false; } return true; } -- cgit v1.2.3