From 3d1d7687c071fe56beeed52839d49328e54aff11 Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Sun, 2 Jan 2022 23:20:48 -0800 Subject: [PATCH] Fix path in UI --- .../Sources/SecretKit/PublicKeyStandinFileController.swift | 5 +++-- Sources/SecretAgent/AppDelegate.swift | 2 +- Sources/Secretive/Views/SecretDetailView.swift | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Sources/Packages/Sources/SecretKit/PublicKeyStandinFileController.swift b/Sources/Packages/Sources/SecretKit/PublicKeyStandinFileController.swift index 3eff37f..3f6db48 100644 --- a/Sources/Packages/Sources/SecretKit/PublicKeyStandinFileController.swift +++ b/Sources/Packages/Sources/SecretKit/PublicKeyStandinFileController.swift @@ -5,10 +5,11 @@ import OSLog public class PublicKeyFileStoreController { private let logger = Logger() - private let directory = NSHomeDirectory().appending("/PublicKeys") + private let directory: String /// Initializes a PublicKeyFileStoreController. - public init() { + public init(homeDirectory: String) { + directory = homeDirectory.appending("/PublicKeys") } /// Writes out the keys specified to disk. diff --git a/Sources/SecretAgent/AppDelegate.swift b/Sources/SecretAgent/AppDelegate.swift index cbf20b7..2c221dd 100644 --- a/Sources/SecretAgent/AppDelegate.swift +++ b/Sources/SecretAgent/AppDelegate.swift @@ -18,7 +18,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { }() private let updater = Updater(checkOnLaunch: false) private let notifier = Notifier() - private let publicKeyFileStoreController = PublicKeyFileStoreController() + private let publicKeyFileStoreController = PublicKeyFileStoreController(homeDirectory: NSHomeDirectory()) private lazy var agent: Agent = { Agent(storeList: storeList, witness: notifier) }() diff --git a/Sources/Secretive/Views/SecretDetailView.swift b/Sources/Secretive/Views/SecretDetailView.swift index 1980ddc..d756679 100644 --- a/Sources/Secretive/Views/SecretDetailView.swift +++ b/Sources/Secretive/Views/SecretDetailView.swift @@ -6,7 +6,7 @@ struct SecretDetailView: View { @State var secret: SecretType private let keyWriter = OpenSSHKeyWriter() - private let publicKeyFileStoreController = PublicKeyFileStoreController() + private let publicKeyFileStoreController = PublicKeyFileStoreController(homeDirectory: NSHomeDirectory().replacingOccurrences(of: Bundle.main.hostBundleID, with: Bundle.main.agentBundleID)) var body: some View { ScrollView {