🔊 Log message showing trashed app location

This commit is contained in:
Ben Chatelain 2019-01-20 21:50:15 -07:00
parent 1925144366
commit 1f84bf2340

View file

@ -42,7 +42,17 @@ public class MasAppLibrary: AppLibrary {
let appUrl = URL(fileURLWithPath: app.bundlePath)
do {
try fileManager.trashItem(at: appUrl, resultingItemURL: nil)
var trashUrl: NSURL?
try withUnsafeMutablePointer(to: &trashUrl) { (mutablePointer: UnsafeMutablePointer<NSURL?>) in
let pointer = AutoreleasingUnsafeMutablePointer<NSURL?>(mutablePointer)
// Move item to trash
try fileManager.trashItem(at: appUrl, resultingItemURL: pointer)
if let url = pointer.pointee, let path = url.path {
printInfo("App moved to trash: \(path)")
}
}
} catch {
printError("Unable to move app to trash.")
throw MASError.uninstallFailed