Skip to content

Commit aa0542b

Browse files
authored
Update dump.swift
1 parent 3700b3a commit aa0542b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Sources/appdecrypt/dump.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,15 @@ class Dump {
4545
#endif
4646
do {
4747
consoleIO.writeMessage("Copy From \(sourceUrl) to \(targetUrl)")
48-
if fileManager.fileExists(atPath: targetUrl) {
48+
var isDirectory: ObjCBool = false
49+
if fileManager.fileExists(atPath: targetUrl, isDirectory: &isDirectory) {
4950
// remove old files to ensure the integrity of the dump
50-
try fileManager.removeItem(atPath: targetUrl)
51-
consoleIO.writeMessage("Success to remove \(targetUrl)")
51+
if isDirectory.boolValue && !targetUrl.hasSuffix(".app") {
52+
consoleIO.writeMessage("\(targetUrl) is a Directory")
53+
} else {
54+
try fileManager.removeItem(atPath: targetUrl)
55+
consoleIO.writeMessage("Success to remove \(targetUrl)")
56+
}
5257
}
5358
try fileManager.copyItem(atPath: sourceUrl, toPath: targetUrl)
5459
consoleIO.writeMessage("Success to copy file.")

0 commit comments

Comments
 (0)