refactor erase function
This commit is contained in:
parent
931e21008b
commit
b73605ee9e
1 changed files with 4 additions and 20 deletions
|
|
@ -184,26 +184,10 @@ class PasswordStore {
|
|||
}
|
||||
|
||||
func erase() {
|
||||
let fm = FileManager.default
|
||||
do {
|
||||
if fm.fileExists(atPath: storeURL.path) {
|
||||
try fm.removeItem(at: storeURL)
|
||||
}
|
||||
|
||||
if fm.fileExists(atPath: Globals.secringPath) {
|
||||
try fm.removeItem(atPath: Globals.secringPath)
|
||||
}
|
||||
|
||||
if fm.fileExists(atPath: Globals.sshPrivateKeyPath.path) {
|
||||
try fm.removeItem(at: Globals.sshPrivateKeyPath)
|
||||
}
|
||||
|
||||
if fm.fileExists(atPath: Globals.sshPublicKeyPath.path) {
|
||||
try fm.removeItem(at: Globals.sshPublicKeyPath)
|
||||
}
|
||||
} catch {
|
||||
print(error)
|
||||
}
|
||||
Utils.removeFileIfExists(at: storeURL)
|
||||
Utils.removeFileIfExists(atPath: Globals.secringPath)
|
||||
Utils.removeFileIfExists(at: Globals.sshPrivateKeyPath)
|
||||
Utils.removeFileIfExists(at: Globals.sshPublicKeyPath)
|
||||
|
||||
deleteCoreData(entityName: "PasswordEntity")
|
||||
deleteCoreData(entityName: "PasswordCategoryEntity")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue