!249 删除文件前判断文件是否存在

Merge pull request !249 from liduo/fix_mac_delete_error
This commit is contained in:
openharmony_ci
2025-08-08 12:07:11 +00:00
committed by Gitee
2 changed files with 9 additions and 1 deletions
+3
View File
@@ -297,6 +297,9 @@ bool FileEntry::IsIgnore(const string &filename) const
bool FileEntry::RemoveAllDirInner(const FileEntry &entry)
{
string path = entry.GetFilePath().GetPath();
if (!Exist(path)) {
return true;
}
if (entry.IsFile()) {
#ifdef _WIN32
bool result = remove(AdaptLongPath(path).c_str()) == 0;
+6 -1
View File
@@ -90,7 +90,12 @@ bool ResourceAppend::Combine(const string &folderPath)
.FormatCause(child->GetFilePath().GetPath().c_str(), "not a file"));
return false;
}
if (child->GetFilePath().GetFilename() == ID_DEFINED_FILE) {
const std::string fileName = child->GetFilePath().GetFilename();
if (fileName == ID_DEFINED_FILE) {
continue;
}
if (fileName.find('.') == 0) {
// The file starts with '.' is invalid
continue;
}
if (!LoadResourceItem(child->GetFilePath().GetPath())) {