@@ -1621,7 +1621,7 @@ bool TWPartition::Check_MD5(PartitionSettings *part_settings) {
16211621 sync ();
16221622
16231623 memset (split_filename, 0 , sizeof (split_filename));
1624- Full_Filename = part_settings->Restore_Name + " /" + part_settings-> Backup_FileName ;
1624+ Full_Filename = part_settings->Backup_Folder + " /" + Backup_FileName;
16251625 if (!TWFunc::Path_Exists (Full_Filename)) {
16261626 // This is a split archive, we presume
16271627 sprintf (split_filename, " %s%03i" , Full_Filename.c_str (), index);
@@ -1662,7 +1662,7 @@ bool TWPartition::Check_MD5(PartitionSettings *part_settings) {
16621662
16631663bool TWPartition::Restore (PartitionSettings *part_settings) {
16641664 TWFunc::GUI_Operation_Text (TW_RESTORE_TEXT, Display_Name, gui_parse_text (" {@restoring_hdr}" ));
1665- LOGINFO (" Restore filename is: %s/ %s\n " , part_settings->Restore_Name .c_str (), part_settings-> Backup_FileName .c_str ());
1665+ LOGINFO (" Restore filename is: %s%s\n " , part_settings->Backup_Folder .c_str (), Backup_FileName.c_str ());
16661666
16671667 string Restore_File_System = Get_Restore_File_System (part_settings);
16681668
@@ -1680,12 +1680,12 @@ string TWPartition::Get_Restore_File_System(PartitionSettings *part_settings) {
16801680 string Restore_File_System;
16811681
16821682 // Parse backup filename to extract the file system before wiping
1683- first_period = part_settings-> Backup_FileName .find (" ." );
1683+ first_period = Backup_FileName.find (" ." );
16841684 if (first_period == string::npos) {
16851685 LOGERR (" Unable to find file system (first period).\n " );
16861686 return string ();
16871687 }
1688- Restore_File_System = part_settings-> Backup_FileName .substr (first_period + 1 , part_settings-> Backup_FileName .size () - first_period - 1 );
1688+ Restore_File_System = Backup_FileName.substr (first_period + 1 , Backup_FileName.size () - first_period - 1 );
16891689 second_period = Restore_File_System.find (" ." );
16901690 if (second_period == string::npos) {
16911691 LOGERR (" Unable to find file system (second period).\n " );
@@ -2167,14 +2167,14 @@ bool TWPartition::Backup_Tar(PartitionSettings *part_settings, pid_t *tar_fork_p
21672167#endif
21682168
21692169 Backup_FileName = Backup_Name + " ." + Current_File_System + " .win" ;
2170- Full_FileName = part_settings->Full_Backup_Path + Backup_FileName;
2170+ Full_FileName = part_settings->Backup_Folder + Backup_FileName;
21712171 tar.has_data_media = Has_Data_Media;
21722172 tar.part_settings = part_settings;
21732173 tar.setdir (Backup_Path);
21742174 tar.setfn (Full_FileName);
21752175 tar.setsize (Backup_Size);
21762176 tar.partition_name = Backup_Name;
2177- tar.backup_folder = part_settings->Full_Backup_Path ;
2177+ tar.backup_folder = part_settings->Backup_Folder ;
21782178 if (tar.createTarFork (tar_fork_pid) != 0 )
21792179 return false ;
21802180 return true ;
@@ -2191,10 +2191,10 @@ bool TWPartition::Backup_Image(PartitionSettings *part_settings) {
21912191
21922192 if (part_settings->adbbackup ) {
21932193 Full_FileName = TW_ADB_BACKUP;
2194- adb_file_name = part_settings->Full_Backup_Path + " /" + Backup_FileName;
2194+ adb_file_name = part_settings->Backup_Folder + " /" + Backup_FileName;
21952195 }
21962196 else
2197- Full_FileName = part_settings->Full_Backup_Path + " /" + Backup_FileName;
2197+ Full_FileName = part_settings->Backup_Folder + " /" + Backup_FileName;
21982198
21992199 part_settings->total_restore_size = Backup_Size;
22002200
@@ -2227,14 +2227,14 @@ bool TWPartition::Raw_Read_Write(PartitionSettings *part_settings) {
22272227 if (part_settings->adbbackup )
22282228 destfn = TW_ADB_BACKUP;
22292229 else
2230- destfn = part_settings->Full_Backup_Path + part_settings-> Backup_FileName ;
2230+ destfn = part_settings->Backup_Folder + Backup_FileName;
22312231 }
22322232 else {
22332233 destfn = Actual_Block_Device;
22342234 if (part_settings->adbbackup ) {
22352235 srcfn = TW_ADB_RESTORE;
22362236 } else {
2237- srcfn = part_settings->Restore_Name + " /" + part_settings-> Backup_FileName ;
2237+ srcfn = part_settings->Backup_Folder + " /" + Backup_FileName;
22382238 Remain = TWFunc::Get_File_Size (srcfn);
22392239 }
22402240 }
@@ -2315,7 +2315,7 @@ bool TWPartition::Backup_Dump_Image(PartitionSettings *part_settings) {
23152315 part_settings->progress ->SetPartitionSize (Backup_Size);
23162316
23172317 Backup_FileName = Backup_Name + " ." + Current_File_System + " .win" ;
2318- Full_FileName = part_settings->Full_Backup_Path + " /" + Backup_FileName;
2318+ Full_FileName = part_settings->Backup_Folder + " /" + Backup_FileName;
23192319
23202320 Command = " dump_image " + MTD_Name + " '" + Full_FileName + " '" ;
23212321
@@ -2335,7 +2335,7 @@ bool TWPartition::Backup_Dump_Image(PartitionSettings *part_settings) {
23352335
23362336unsigned long long TWPartition::Get_Restore_Size (PartitionSettings *part_settings) {
23372337 if (!part_settings->adbbackup ) {
2338- InfoManager restore_info (part_settings->Restore_Name + " /" + Backup_Name + " .info" );
2338+ InfoManager restore_info (part_settings->Backup_Folder + " /" + Backup_Name + " .info" );
23392339 if (restore_info.LoadValues () == 0 ) {
23402340 if (restore_info.GetValue (" backup_size" , Restore_Size) == 0 ) {
23412341 LOGINFO (" Read info file, restore size is %llu\n " , Restore_Size);
@@ -2346,7 +2346,7 @@ unsigned long long TWPartition::Get_Restore_Size(PartitionSettings *part_setting
23462346
23472347 string Full_FileName, Restore_File_System = Get_Restore_File_System (part_settings);
23482348
2349- Full_FileName = part_settings->Restore_Name + " /" + Backup_FileName;
2349+ Full_FileName = part_settings->Backup_Folder + " /" + Backup_FileName;
23502350 if (Is_Image (Restore_File_System)) {
23512351 Restore_Size = TWFunc::Get_File_Size (Full_FileName);
23522352 return Restore_Size;
@@ -2363,7 +2363,7 @@ unsigned long long TWPartition::Get_Restore_Size(PartitionSettings *part_setting
23632363 tar.setpassword (Password);
23642364#endif
23652365 tar.partition_name = Backup_Name;
2366- tar.backup_folder = part_settings->Restore_Name ;
2366+ tar.backup_folder = part_settings->Backup_Folder ;
23672367 tar.part_settings = part_settings;
23682368 Restore_Size = tar.get_size ();
23692369 return Restore_Size;
@@ -2395,7 +2395,7 @@ bool TWPartition::Restore_Tar(PartitionSettings *part_settings) {
23952395 if (!ReMount_RW (true ))
23962396 return false ;
23972397
2398- Full_FileName = part_settings->Restore_Name + " /" + part_settings-> Backup_FileName ;
2398+ Full_FileName = part_settings->Backup_Folder + " /" + Backup_FileName;
23992399 twrpTar tar;
24002400 tar.part_settings = part_settings;
24012401 tar.setdir (Backup_Path);
@@ -2448,7 +2448,7 @@ bool TWPartition::Restore_Image(PartitionSettings *part_settings) {
24482448 if (part_settings->adbbackup )
24492449 Full_FileName = TW_ADB_RESTORE;
24502450 else
2451- Full_FileName = part_settings->Full_Backup_Path + part_settings-> Backup_FileName ;
2451+ Full_FileName = part_settings->Backup_Folder + Backup_FileName;
24522452
24532453 if (Restore_File_System == " emmc" ) {
24542454 if (!part_settings->adbbackup )
@@ -2607,9 +2607,12 @@ uint64_t TWPartition::Get_Max_FileSize() {
26072607bool TWPartition::Flash_Image (PartitionSettings *part_settings) {
26082608 string Restore_File_System, full_filename;
26092609
2610- full_filename = part_settings->Restore_Name + " /" + part_settings->Backup_FileName ;
2610+ if (part_settings->Part != NULL )
2611+ full_filename = part_settings->Backup_Folder + " /" + Backup_FileName;
2612+ else
2613+ full_filename = part_settings->Backup_Folder ; // Flash image action from GUI
26112614
2612- LOGINFO (" Image filename is: %s\n " , part_settings-> Backup_FileName .c_str ());
2615+ LOGINFO (" Image filename is: %s\n " , Backup_FileName.c_str ());
26132616
26142617 if (Backup_Method == BM_FILES) {
26152618 LOGERR (" Cannot flash images to file systems\n " );
@@ -2625,7 +2628,7 @@ bool TWPartition::Flash_Image(PartitionSettings *part_settings) {
26252628 unsigned long long image_size = TWFunc::Get_File_Size (full_filename);
26262629 if (image_size > Size) {
26272630 LOGINFO (" Size (%llu bytes) of image '%s' is larger than target device '%s' (%llu bytes)\n " ,
2628- image_size, part_settings-> Backup_FileName .c_str (), Actual_Block_Device.c_str (), Size);
2631+ image_size, Backup_FileName.c_str (), Actual_Block_Device.c_str (), Size);
26292632 gui_err (" img_size_err=Size of image is larger than target device" );
26302633 return false ;
26312634 }
0 commit comments