Refactoring: Consolidate file deletion into a separate function
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
1 parent
290bd192a0
commit
f6faffa4c1
3 files changed
+16
-17
No files matched your search
@@ -16,4 +16,14 @@ extension FileManager {
|
||||
}
|
||||
return sharedFolderURL.appendingPathComponent("lastActivatedTunnelLog.txt")
|
||||
}
|
||||
|
||||
static func deleteFile(at url: URL) -> Bool {
|
||||
do {
|
||||
try FileManager.default.removeItem(at: url)
|
||||
} catch(let e) {
|
||||
os_log("Failed to delete file '%{public}@': %{public}@", log: OSLog.default, type: .debug, url.absoluteString, e.localizedDescription)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user