@@ -1621,7 +1621,7 @@ bool TWPartition::Check_MD5(PartitionSettings *part_settings) {
1621
1621
sync ();
1622
1622
1623
1623
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;
1625
1625
if (!TWFunc::Path_Exists (Full_Filename)) {
1626
1626
// This is a split archive, we presume
1627
1627
sprintf (split_filename, " %s%03i" , Full_Filename.c_str (), index );
@@ -1662,7 +1662,7 @@ bool TWPartition::Check_MD5(PartitionSettings *part_settings) {
1662
1662
1663
1663
bool TWPartition::Restore (PartitionSettings *part_settings) {
1664
1664
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 ());
1666
1666
1667
1667
string Restore_File_System = Get_Restore_File_System (part_settings);
1668
1668
@@ -1680,12 +1680,12 @@ string TWPartition::Get_Restore_File_System(PartitionSettings *part_settings) {
1680
1680
string Restore_File_System;
1681
1681
1682
1682
// Parse backup filename to extract the file system before wiping
1683
- first_period = part_settings-> Backup_FileName .find (" ." );
1683
+ first_period = Backup_FileName.find (" ." );
1684
1684
if (first_period == string::npos) {
1685
1685
LOGERR (" Unable to find file system (first period).\n " );
1686
1686
return string ();
1687
1687
}
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 );
1689
1689
second_period = Restore_File_System.find (" ." );
1690
1690
if (second_period == string::npos) {
1691
1691
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
2167
2167
#endif
2168
2168
2169
2169
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;
2171
2171
tar.has_data_media = Has_Data_Media;
2172
2172
tar.part_settings = part_settings;
2173
2173
tar.setdir (Backup_Path);
2174
2174
tar.setfn (Full_FileName);
2175
2175
tar.setsize (Backup_Size);
2176
2176
tar.partition_name = Backup_Name;
2177
- tar.backup_folder = part_settings->Full_Backup_Path ;
2177
+ tar.backup_folder = part_settings->Backup_Folder ;
2178
2178
if (tar.createTarFork (tar_fork_pid) != 0 )
2179
2179
return false ;
2180
2180
return true ;
@@ -2191,10 +2191,10 @@ bool TWPartition::Backup_Image(PartitionSettings *part_settings) {
2191
2191
2192
2192
if (part_settings->adbbackup ) {
2193
2193
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;
2195
2195
}
2196
2196
else
2197
- Full_FileName = part_settings->Full_Backup_Path + " /" + Backup_FileName;
2197
+ Full_FileName = part_settings->Backup_Folder + " /" + Backup_FileName;
2198
2198
2199
2199
part_settings->total_restore_size = Backup_Size;
2200
2200
@@ -2227,14 +2227,14 @@ bool TWPartition::Raw_Read_Write(PartitionSettings *part_settings) {
2227
2227
if (part_settings->adbbackup )
2228
2228
destfn = TW_ADB_BACKUP;
2229
2229
else
2230
- destfn = part_settings->Full_Backup_Path + part_settings-> Backup_FileName ;
2230
+ destfn = part_settings->Backup_Folder + Backup_FileName;
2231
2231
}
2232
2232
else {
2233
2233
destfn = Actual_Block_Device;
2234
2234
if (part_settings->adbbackup ) {
2235
2235
srcfn = TW_ADB_RESTORE;
2236
2236
} else {
2237
- srcfn = part_settings->Restore_Name + " /" + part_settings-> Backup_FileName ;
2237
+ srcfn = part_settings->Backup_Folder + " /" + Backup_FileName;
2238
2238
Remain = TWFunc::Get_File_Size (srcfn);
2239
2239
}
2240
2240
}
@@ -2315,7 +2315,7 @@ bool TWPartition::Backup_Dump_Image(PartitionSettings *part_settings) {
2315
2315
part_settings->progress ->SetPartitionSize (Backup_Size);
2316
2316
2317
2317
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;
2319
2319
2320
2320
Command = " dump_image " + MTD_Name + " '" + Full_FileName + " '" ;
2321
2321
@@ -2335,7 +2335,7 @@ bool TWPartition::Backup_Dump_Image(PartitionSettings *part_settings) {
2335
2335
2336
2336
unsigned long long TWPartition::Get_Restore_Size (PartitionSettings *part_settings) {
2337
2337
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" );
2339
2339
if (restore_info.LoadValues () == 0 ) {
2340
2340
if (restore_info.GetValue (" backup_size" , Restore_Size) == 0 ) {
2341
2341
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
2346
2346
2347
2347
string Full_FileName, Restore_File_System = Get_Restore_File_System (part_settings);
2348
2348
2349
- Full_FileName = part_settings->Restore_Name + " /" + Backup_FileName;
2349
+ Full_FileName = part_settings->Backup_Folder + " /" + Backup_FileName;
2350
2350
if (Is_Image (Restore_File_System)) {
2351
2351
Restore_Size = TWFunc::Get_File_Size (Full_FileName);
2352
2352
return Restore_Size;
@@ -2363,7 +2363,7 @@ unsigned long long TWPartition::Get_Restore_Size(PartitionSettings *part_setting
2363
2363
tar.setpassword (Password);
2364
2364
#endif
2365
2365
tar.partition_name = Backup_Name;
2366
- tar.backup_folder = part_settings->Restore_Name ;
2366
+ tar.backup_folder = part_settings->Backup_Folder ;
2367
2367
tar.part_settings = part_settings;
2368
2368
Restore_Size = tar.get_size ();
2369
2369
return Restore_Size;
@@ -2395,7 +2395,7 @@ bool TWPartition::Restore_Tar(PartitionSettings *part_settings) {
2395
2395
if (!ReMount_RW (true ))
2396
2396
return false ;
2397
2397
2398
- Full_FileName = part_settings->Restore_Name + " /" + part_settings-> Backup_FileName ;
2398
+ Full_FileName = part_settings->Backup_Folder + " /" + Backup_FileName;
2399
2399
twrpTar tar;
2400
2400
tar.part_settings = part_settings;
2401
2401
tar.setdir (Backup_Path);
@@ -2448,7 +2448,7 @@ bool TWPartition::Restore_Image(PartitionSettings *part_settings) {
2448
2448
if (part_settings->adbbackup )
2449
2449
Full_FileName = TW_ADB_RESTORE;
2450
2450
else
2451
- Full_FileName = part_settings->Full_Backup_Path + part_settings-> Backup_FileName ;
2451
+ Full_FileName = part_settings->Backup_Folder + Backup_FileName;
2452
2452
2453
2453
if (Restore_File_System == " emmc" ) {
2454
2454
if (!part_settings->adbbackup )
@@ -2607,9 +2607,12 @@ uint64_t TWPartition::Get_Max_FileSize() {
2607
2607
bool TWPartition::Flash_Image (PartitionSettings *part_settings) {
2608
2608
string Restore_File_System, full_filename;
2609
2609
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
2611
2614
2612
- LOGINFO (" Image filename is: %s\n " , part_settings-> Backup_FileName .c_str ());
2615
+ LOGINFO (" Image filename is: %s\n " , Backup_FileName.c_str ());
2613
2616
2614
2617
if (Backup_Method == BM_FILES) {
2615
2618
LOGERR (" Cannot flash images to file systems\n " );
@@ -2625,7 +2628,7 @@ bool TWPartition::Flash_Image(PartitionSettings *part_settings) {
2625
2628
unsigned long long image_size = TWFunc::Get_File_Size (full_filename);
2626
2629
if (image_size > Size ) {
2627
2630
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 );
2629
2632
gui_err (" img_size_err=Size of image is larger than target device" );
2630
2633
return false ;
2631
2634
}
0 commit comments