From aa0542b2438a4351f1b7800377e163d3ec0ffb91 Mon Sep 17 00:00:00 2001 From: "svg onload=alert(1)" <14846965+paradiseduo@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:16:05 +0800 Subject: [PATCH] Update dump.swift --- Sources/appdecrypt/dump.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Sources/appdecrypt/dump.swift b/Sources/appdecrypt/dump.swift index ffb0322..d4bab61 100644 --- a/Sources/appdecrypt/dump.swift +++ b/Sources/appdecrypt/dump.swift @@ -45,10 +45,15 @@ class Dump { #endif do { consoleIO.writeMessage("Copy From \(sourceUrl) to \(targetUrl)") - if fileManager.fileExists(atPath: targetUrl) { + var isDirectory: ObjCBool = false + if fileManager.fileExists(atPath: targetUrl, isDirectory: &isDirectory) { // remove old files to ensure the integrity of the dump - try fileManager.removeItem(atPath: targetUrl) - consoleIO.writeMessage("Success to remove \(targetUrl)") + if isDirectory.boolValue && !targetUrl.hasSuffix(".app") { + consoleIO.writeMessage("\(targetUrl) is a Directory") + } else { + try fileManager.removeItem(atPath: targetUrl) + consoleIO.writeMessage("Success to remove \(targetUrl)") + } } try fileManager.copyItem(atPath: sourceUrl, toPath: targetUrl) consoleIO.writeMessage("Success to copy file.")