From e5d60c42329fc6231d330391a88c014e5c8c77db Mon Sep 17 00:00:00 2001 From: N2614 Date: Thu, 6 Oct 2011 06:55:17 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=90=E3=82=B7=E3=83=A7=E3=83=88=E3=83=AA?= =?UTF-8?q?=E3=83=A3=E3=83=BC=E7=94=A8=E3=82=BB=E3=83=BC=E3=83=96=E3=83=87?= =?UTF-8?q?=E3=83=BC=E3=82=BF=E3=81=AF=E5=95=8F=E7=AD=94=E7=84=A1=E7=94=A8?= =?UTF-8?q?=E3=81=A7=E6=B6=88=E3=81=99=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@447 385bec56-5757-e545-9c3a-d8741f4650f1 --- .../sources/ConsoleBackup/SavedataChecker.cpp | 37 +++++++++++++++---- .../sources/ConsoleBackup/SavedataChecker.h | 5 ++- .../sources/common/FileName.h | 2 + 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/trunk/ConsoleDataMigration/sources/ConsoleBackup/SavedataChecker.cpp b/trunk/ConsoleDataMigration/sources/ConsoleBackup/SavedataChecker.cpp index b8c75b8..6169b9a 100644 --- a/trunk/ConsoleDataMigration/sources/ConsoleBackup/SavedataChecker.cpp +++ b/trunk/ConsoleDataMigration/sources/ConsoleBackup/SavedataChecker.cpp @@ -19,6 +19,7 @@ #include "SavedataChecker.h" #include "CommonLogger.h" #include "FileTransfer.h" +#include "FileName.h" namespace ConsoleBackup { @@ -114,11 +115,18 @@ nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::str if(result.IsFailure()) { nn::dbg::PrintResult(result); - COMMON_LOGGER_WARN("Error: %s/%s\n", baseName.c_str(), common::GetCharStr(GetFilePathWithoutArchive(filePath).c_str())); - m_CheckErrorOccured = true; - if (erase) + const bool silent = IsForceDeleteFile(common::GetCharStr(entry.entryName)); + if(!silent) { - COMMON_LOGGER_WARN("Deleting: %s/%s\n", baseName.c_str(), common::GetCharStr(GetFilePathWithoutArchive(filePath).c_str())); + COMMON_LOGGER_WARN("Error: %s/%s\n", baseName.c_str(), common::GetCharStr(GetFilePathWithoutArchive(filePath).c_str())); + m_CheckErrorOccured = true; + } + if (erase || silent) + { + if(!silent) + { + COMMON_LOGGER_WARN("Deleting: %s/%s\n", baseName.c_str(), common::GetCharStr(GetFilePathWithoutArchive(filePath).c_str())); + } result = nn::fs::TryDeleteFile(path); *modified = true; } @@ -132,13 +140,21 @@ nn::Result SavedataCheckerBase::CleanUpFilesRecursively(bool* modified, std::str if(result.IsFailure()) { nn::dbg::PrintResult(result); - COMMON_LOGGER_WARN("Error: %s/%s\n", baseName.c_str(), common::GetCharStr(GetFilePathWithoutArchive(filePath).c_str())); + const bool silent = IsForceDeleteFile(common::GetCharStr(entry.entryName)); + if(!silent) + { + COMMON_LOGGER_WARN("Error: %s/%s\n", baseName.c_str(), common::GetCharStr(GetFilePathWithoutArchive(filePath).c_str())); + m_CheckErrorOccured = true; + } + m_TotalReadSize += file.GetSize(); file.Finalize(); - m_CheckErrorOccured = true; - if (erase) + if (erase || silent) { - COMMON_LOGGER_WARN("Deleting: %s/%s\n", baseName.c_str(), common::GetCharStr(GetFilePathWithoutArchive(filePath).c_str())); + if(!silent) + { + COMMON_LOGGER_WARN("Deleting: %s/%s\n", baseName.c_str(), common::GetCharStr(GetFilePathWithoutArchive(filePath).c_str())); + } result = nn::fs::TryDeleteFile(path); COMMON_LOGGER_RESULT_IF_FAILED(result); *modified = true; @@ -248,6 +264,11 @@ std::wstring SavedataCheckerBase::GetFilePathWithoutArchive(std::wstring path) } } +bool SavedataCheckerBase::IsForceDeleteFile(const char* name) +{ + return std::strcmp(common::BASHOTORYA_FILE_NAME, name) == 0; +} + NandSavedataChecker::NandSavedataChecker() { // TODO 自動生成されたコンストラクター・スタブ diff --git a/trunk/ConsoleDataMigration/sources/ConsoleBackup/SavedataChecker.h b/trunk/ConsoleDataMigration/sources/ConsoleBackup/SavedataChecker.h index 5d8fa49..041ee6a 100644 --- a/trunk/ConsoleDataMigration/sources/ConsoleBackup/SavedataChecker.h +++ b/trunk/ConsoleDataMigration/sources/ConsoleBackup/SavedataChecker.h @@ -139,9 +139,9 @@ public: protected: //! @brief ファイルとディレクトリを再帰的にチェックする。エラーがあれば削除する - //! @param[out] modified ファイルかディレクトリを削除したかどうか + //! @param[out] modified ファイルかディレクトリを削除したかどうか。Commitするかどうかの判断に使用する //! @param[in] baseName 削除するセーブデータの区別に表示するための名前 - //! @param[in] currentDirectory チェックを開始するディレクトリ。スラッシュで終端すること。 + //! @param[in] currentDirectory チェックを開始するディレクトリ。スラッシュで終端すること //! @param[in] erase ファイルかディレクトリを削除するかどうか nn::Result CleanUpFilesRecursively(bool* modified, std::string baseName, std::wstring currentDirectory, bool erase); @@ -171,6 +171,7 @@ protected: private: std::wstring GetFilePathWithoutArchive(std::wstring path); + bool IsForceDeleteFile(const char* name); }; diff --git a/trunk/ConsoleDataMigration/sources/common/FileName.h b/trunk/ConsoleDataMigration/sources/common/FileName.h index 0d45e9c..dd92c30 100644 --- a/trunk/ConsoleDataMigration/sources/common/FileName.h +++ b/trunk/ConsoleDataMigration/sources/common/FileName.h @@ -27,6 +27,8 @@ const char* const NAND_TWL_PHOTO_ARCHIVE_NAME = "twlp:"; const char* const NAND_TWL_SOUND_ARCHIVE_NAME = "twls:"; const char* const NAND_TWL_ARCHIVE_NAME = "twln:"; +const char* const BASHOTORYA_FILE_NAME = "bashotorya.dat"; + const wchar_t* const LOG_ROOT_DIRECTORY_PATH = L"sdmc:/CTR_Console_Repair"; const wchar_t* const SD_SAVEDATA_ROOT_NAME = L"CTR_Console_Repair/CTRBackup/"; const wchar_t* const SD_SAVEDATA_TWL_PHOTO_ROOT_NAME = L"CTR_Console_Repair/TWLPhotoBackup/";