diff --git a/frameworks/native/backup_ext/src/ext_extension.cpp b/frameworks/native/backup_ext/src/ext_extension.cpp index 5babf43fa1598a4df7b47b23920fb965f1b1e61e..5dcc23aeb2326bee3d5d61471a9c430a7aa6735d 100644 --- a/frameworks/native/backup_ext/src/ext_extension.cpp +++ b/frameworks/native/backup_ext/src/ext_extension.cpp @@ -522,7 +522,7 @@ static bool RestoreBigFilePrecheck(string& fileName, const string& path, return true; } -static void RestoreBigFiles() +static void RestoreBigFiles(bool appendTargetPath) { // 获取索引文件内容 string path = string(BConstants::PATH_BUNDLE_BACKUP_HOME).append(BConstants::SA_BUNDLE_BACKUP_RESTORE); @@ -536,7 +536,7 @@ static void RestoreBigFiles() } string fileName = path + item.hashName; - string filePath = item.fileName; + string filePath = appendTargetPath ? (path + item.fileName) : item.fileName; struct stat sta = item.sta; if (!RestoreBigFilePrecheck(fileName, path, item.hashName, filePath)) { @@ -606,7 +606,10 @@ void BackupExtExtension::AsyncTaskRestore() } } // 恢复用户tar包以及大文件 - RestoreBigFiles(); + // 目的地址是否需要拼接path(临时目录),FullBackupOnly为true并且非特殊场景 + bool appendTargetPath = ptr->extension_->UseFullBackupOnly() && + !ptr->extension_->SpeicalVersionForCloneAndCloud(); + RestoreBigFiles(appendTargetPath); // delete 1.tar/manage.json DeleteBackupTars();