Skip to content

Commit

Permalink
Update dump.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
paradiseduo authored Nov 12, 2024
1 parent 3700b3a commit aa0542b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Sources/appdecrypt/dump.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down

0 comments on commit aa0542b

Please sign in to comment.