Fix backup and restore after autodetection for SAR
This reverts commit 8a411c8d25.
* Always use "/system" to interact with the frontend and replace it
with the detected path before taking actions.
* Don't replace the pretty display name and backup name set during
processing fstab after wipe. This improves UX and ensures that the
system backup is always named system.ext4.win despite the actual
mount point is /system_root so TWRP is able to recover either SAR or
non-SAR backups.
Change-Id: Ie2594d2678d0c75ce25c0d1087d47b035b3f10e9
This commit is contained in:
+10
-2
@@ -599,6 +599,8 @@ TWPartition* TWPartitionManager::Find_Partition_By_Path(const string& Path) {
|
||||
std::vector<TWPartition*>::iterator iter;
|
||||
string Local_Path = TWFunc::Get_Root_Path(Path);
|
||||
|
||||
if (Local_Path == "/system")
|
||||
Local_Path = Get_Android_Root_Path();
|
||||
for (iter = Partitions.begin(); iter != Partitions.end(); iter++) {
|
||||
if ((*iter)->Mount_Point == Local_Path || (!(*iter)->Symlink_Mount_Point.empty() && (*iter)->Symlink_Mount_Point == Local_Path))
|
||||
return (*iter);
|
||||
@@ -1273,8 +1275,12 @@ void TWPartitionManager::Set_Restore_Files(string Restore_Name) {
|
||||
Part->Backup_FileName.resize(Part->Backup_FileName.size() - strlen(extn) + 3);
|
||||
}
|
||||
|
||||
if (!Part->Is_SubPartition)
|
||||
Restore_List += Part->Backup_Path + ";";
|
||||
if (!Part->Is_SubPartition) {
|
||||
if (Part->Backup_Path == Get_Android_Root_Path())
|
||||
Restore_List += "/system;";
|
||||
else
|
||||
Restore_List += Part->Backup_Path + ";";
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
}
|
||||
@@ -1297,6 +1303,8 @@ int TWPartitionManager::Wipe_By_Path(string Path) {
|
||||
bool found = false;
|
||||
string Local_Path = TWFunc::Get_Root_Path(Path);
|
||||
|
||||
if (Local_Path == "/system")
|
||||
Local_Path = Get_Android_Root_Path();
|
||||
// Iterate through all partitions
|
||||
for (iter = Partitions.begin(); iter != Partitions.end(); iter++) {
|
||||
if ((*iter)->Mount_Point == Local_Path || (!(*iter)->Symlink_Mount_Point.empty() && (*iter)->Symlink_Mount_Point == Local_Path)) {
|
||||
|
||||
Reference in New Issue
Block a user