Fix #258: Remove existing key files before moving new ones to the same location

This commit is contained in:
Danny Moesch 2019-05-15 22:49:46 +02:00
parent c8860fc36f
commit adff0c1142

View file

@ -838,10 +838,17 @@ public class PasswordStore {
}
public func gitSSHKeyImportFromFileSharing() throws {
if gitSSHKeyExists() {
try fm.removeItem(atPath: Globals.gitSSHPrivateKeyPath)
}
try fm.moveItem(atPath: Globals.iTunesFileSharingSSHPrivate, toPath: Globals.gitSSHPrivateKeyPath)
}
public func pgpKeyImportFromFileSharing() throws {
if pgpKeyExists() {
try fm.removeItem(atPath: Globals.pgpPublicKeyPath)
try fm.removeItem(atPath: Globals.pgpPrivateKeyPath)
}
try fm.moveItem(atPath: Globals.iTunesFileSharingPGPPublic, toPath: Globals.pgpPublicKeyPath)
try fm.moveItem(atPath: Globals.iTunesFileSharingPGPPrivate, toPath: Globals.pgpPrivateKeyPath)
}