diff --git a/Pocket Poster/Controllers/SymHandler.swift b/Pocket Poster/Controllers/SymHandler.swift index 9caed85..a38d391 100644 --- a/Pocket Poster/Controllers/SymHandler.swift +++ b/Pocket Poster/Controllers/SymHandler.swift @@ -15,13 +15,16 @@ class SymHandler { return documentsDirectory } - private static func getSymlinkURL() -> URL { + static func getLCDocumentsDirectory() -> URL { let lcPath = ProcessInfo.processInfo.environment["LC_HOME_PATH"] - var docsDir = getDocumentsDirectory() if let lcPath = lcPath { - docsDir = URL(fileURLWithPath: "\(lcPath)/Documents") + return URL(fileURLWithPath: "\(lcPath)/Documents") } - return docsDir.appendingPathComponent(".Trash", conformingTo: .symbolicLink) + return getDocumentsDirectory() + } + + private static func getSymlinkURL() -> URL { + return getLCDocumentsDirectory().appendingPathComponent(".Trash", conformingTo: .symbolicLink) } // MARK: Symlink Creation diff --git a/Pocket Poster/Views/SettingsView.swift b/Pocket Poster/Views/SettingsView.swift index 50f5e54..80d07c1 100644 --- a/Pocket Poster/Views/SettingsView.swift +++ b/Pocket Poster/Views/SettingsView.swift @@ -126,7 +126,6 @@ struct SettingsView: View { Label("Credits", systemImage: "wrench.and.screwdriver") } } - .padding() .alert(errorAlertTitle ?? "Error", isPresented: $showErrorAlert) { Button("OK") {} } message: { @@ -137,7 +136,7 @@ struct SettingsView: View { func startWaitForHash() { checkingForHash = true hashCheckTask = Task { - let filePath = SymHandler.getDocumentsDirectory().appendingPathComponent("NuggetAppHash") + let filePath = SymHandler.getLCDocumentsDirectory().appendingPathComponent("NuggetAppHash") while !FileManager.default.fileExists(atPath: filePath.path()) { try? await Task.sleep(nanoseconds: 500_000_000) // Sleep 0.5s try Task.checkCancellation()