From 8075d6fd737fdfe985021a8e44dbb69b7666b59b Mon Sep 17 00:00:00 2001 From: hunili Date: Sat, 9 Nov 2024 16:58:35 +0800 Subject: [PATCH] =?UTF-8?q?Open=20debug=20switch=EF=BC=885.0.1=EF=BC=89=20?= =?UTF-8?q?issue:=20https://gitee.com/openharmony/filemanagement=5Fapp=5Ff?= =?UTF-8?q?ile=5Fservice/issues/IB36S5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hunili --- .../native/backup_ext/include/ext_extension.h | 3 ++- .../native/backup_ext/src/ext_extension.cpp | 4 ++-- .../backup_ext/src/sub_ext_extension.cpp | 19 ++++++++++++++----- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/frameworks/native/backup_ext/include/ext_extension.h b/frameworks/native/backup_ext/include/ext_extension.h index 34a509ffb..9c450efb4 100644 --- a/frameworks/native/backup_ext/include/ext_extension.h +++ b/frameworks/native/backup_ext/include/ext_extension.h @@ -260,6 +260,7 @@ private: void DeleteBackupIdxFile(); void DeleteBackupIncrementalTars(const string &tarName); void SetClearDataFlag(bool isClearData); + std::string GetBundlePath(); std::vector GetExtManageInfo(); ErrCode RestoreFilesForSpecialCloneCloud(); void RestoreBigFilesForSpecialCloneCloud(const ExtManageInfo &item); @@ -297,7 +298,7 @@ private: std::string bundleName_; int32_t sendRate_ = BConstants::DEFAULT_FD_SEND_RATE; bool isClearData_ {true}; - bool isDebug_ {false}; + bool isDebug_ {true}; std::map endFileInfos_; std::map> errFileInfos_; bool isRpValid_ {false}; diff --git a/frameworks/native/backup_ext/src/ext_extension.cpp b/frameworks/native/backup_ext/src/ext_extension.cpp index 094d19cb3..2ba8859d9 100644 --- a/frameworks/native/backup_ext/src/ext_extension.cpp +++ b/frameworks/native/backup_ext/src/ext_extension.cpp @@ -1134,9 +1134,9 @@ void BackupExtExtension::FillEndFileInfos(const std::string &path, for (const auto &it : result) { std::string filePath = it.first; if (!filePath.empty() && filePath.size() <= PATH_MAX) { - endFileInfos_[filePath] = it.second.size; + endFileInfos_[path + filePath] = it.second.size; } else { - HILOGE("FileName : %{public}s error", GetAnonyPath(filePath).c_str()); + HILOGE("File name : %{public}s check error", GetAnonyPath(path + filePath).c_str()); } } } diff --git a/frameworks/native/backup_ext/src/sub_ext_extension.cpp b/frameworks/native/backup_ext/src/sub_ext_extension.cpp index cc63b94c5..540cb94ac 100644 --- a/frameworks/native/backup_ext/src/sub_ext_extension.cpp +++ b/frameworks/native/backup_ext/src/sub_ext_extension.cpp @@ -107,11 +107,19 @@ void BackupExtExtension::SetClearDataFlag(bool isClearData) } } +string BackupExtExtension::GetBundlePath() +{ + if (bundleName_ == BConstants::BUNDLE_FILE_MANAGER) { + return string(BConstants::PATH_FILEMANAGE_BACKUP_HOME).append(BConstants::SA_BUNDLE_BACKUP_RESTORE); + } else if (bundleName_ == BConstants::BUNDLE_MEDIAL_DATA) { + return string(BConstants::PATH_MEDIALDATA_BACKUP_HOME).append(BConstants::SA_BUNDLE_BACKUP_RESTORE); + } + return string(BConstants::PATH_BUNDLE_BACKUP_HOME).append(BConstants::SA_BUNDLE_BACKUP_RESTORE); +} + std::map BackupExtExtension::GetIdxFileInfos(bool isSpecialVersion) { - string restoreDir = isSpecialVersion ? - "" : - string(BConstants::PATH_BUNDLE_BACKUP_HOME).append(BConstants::SA_BUNDLE_BACKUP_RESTORE); + string restoreDir = isSpecialVersion ? "" : GetBundlePath(); auto extManageInfo = GetExtManageInfo(); std::map idxFileInfos; for (size_t i = 0; i < extManageInfo.size(); ++i) { @@ -159,11 +167,12 @@ tuple> BackupExtExtension::CheckRestoreFileInfos() struct stat curFileStat {}; for (const auto &it : endFileInfos_) { if (lstat(it.first.c_str(), &curFileStat) != 0) { - HILOGE("(Debug) Failed to lstat, err = %{public}d", errno); + HILOGE("Failed to lstat %{public}s, err = %{public}d", GetAnonyPath(it.first).c_str(), errno); errFiles.emplace_back(it.first); errFileInfos_[it.first].push_back(errno); } else if (curFileStat.st_size != it.second && (!S_ISDIR(curFileStat.st_mode))) { - HILOGE("(Debug) File size check error, file: %{public}s", GetAnonyPath(it.first).c_str()); + HILOGE("File size error, file: %{public}s, idx: %{public}" PRId64 ", act: %{public}" PRId64 "", + GetAnonyPath(it.first).c_str(), it.second, curFileStat.st_size); errFiles.emplace_back(it.first); errFileInfos_[it.first].push_back(errno); } -- Gitee