From d213f183ebb68ce89e7855032772912f7e8bcc43 Mon Sep 17 00:00:00 2001 From: fangyunzhong Date: Fri, 23 Sep 2022 11:05:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E9=87=8F=E7=BC=96=E8=AF=91=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E4=B8=8B=EF=BC=8C=E9=92=88=E5=AF=B9=E5=8D=A0=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E7=9B=AE=E5=BD=95=E5=88=A0=E9=99=A4=E4=B8=8D=E4=BA=86?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E7=BB=A7=E7=BB=AD=E7=BC=96=E8=AF=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fangyunzhong --- src/file_entry.cpp | 7 ++++++- src/resource_pack.cpp | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/file_entry.cpp b/src/file_entry.cpp index ef6cc1c..26d844d 100644 --- a/src/file_entry.cpp +++ b/src/file_entry.cpp @@ -280,7 +280,12 @@ bool FileEntry::IsIgnore(const string &filename) const bool FileEntry::RemoveAllDirInner(const FileEntry &entry) { if (entry.IsFile()) { - return remove(entry.GetFilePath().GetPath().c_str()) == 0; + bool result = remove(entry.GetFilePath().GetPath().c_str()) == 0; + if (!result) { + cerr << "Error: " << entry.GetFilePath().GetPath() << "remove fail !" << endl; + return false; + } + return true; } for (const auto &iter : entry.GetChilds()) { diff --git a/src/resource_pack.cpp b/src/resource_pack.cpp index 9fe369f..6fa33e9 100644 --- a/src/resource_pack.cpp +++ b/src/resource_pack.cpp @@ -125,6 +125,7 @@ uint32_t ResourcePack::InitOutput() const } bool forceWrite = packageParser_.GetForceWrite(); + bool combine = packageParser_.GetCombine(); string output = packageParser_.GetOutput(); string resourcesPath = FileEntry::FilePath(output).Append(RESOURCES_DIR).GetPath(); if (ResourceUtil::FileExist(resourcesPath)) { @@ -134,7 +135,7 @@ uint32_t ResourcePack::InitOutput() const } if (!ResourceUtil::RmoveAllDir(resourcesPath)) { - return RESTOOL_ERROR; + return combine ? RESTOOL_SUCCESS : RESTOOL_ERROR; } } return RESTOOL_SUCCESS;