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() {
|
func erase() {
|
||||||
let fm = FileManager.default
|
Utils.removeFileIfExists(at: storeURL)
|
||||||
do {
|
Utils.removeFileIfExists(atPath: Globals.secringPath)
|
||||||
if fm.fileExists(atPath: storeURL.path) {
|
Utils.removeFileIfExists(at: Globals.sshPrivateKeyPath)
|
||||||
try fm.removeItem(at: storeURL)
|
Utils.removeFileIfExists(at: Globals.sshPublicKeyPath)
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteCoreData(entityName: "PasswordEntity")
|
deleteCoreData(entityName: "PasswordEntity")
|
||||||
deleteCoreData(entityName: "PasswordCategoryEntity")
|
deleteCoreData(entityName: "PasswordCategoryEntity")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue