From 9011bea7ac09b3bc6c78de7b1486e203019045bd Mon Sep 17 00:00:00 2001 From: Joshua Sattler <34030048+jsattler@users.noreply.github.com> Date: Mon, 16 Feb 2026 19:33:59 +0100 Subject: [PATCH] fix: call `startAccessingOutputDirectory` before opening output folder Before this fix opening a custom output folder would fail because we did not make the call to `startAccessingOutputDirectory`. This should fix any permission issues. --- BetterCapture/Service/NotificationService.swift | 6 +++++- BetterCapture/ViewModel/RecorderViewModel.swift | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/BetterCapture/Service/NotificationService.swift b/BetterCapture/Service/NotificationService.swift index e1d54f5..1deba14 100644 --- a/BetterCapture/Service/NotificationService.swift +++ b/BetterCapture/Service/NotificationService.swift @@ -29,6 +29,7 @@ final class NotificationService: NSObject { // MARK: - Properties + private let settings: SettingsStore private let logger = Logger( subsystem: Bundle.main.bundleIdentifier ?? "BetterCapture", category: "NotificationService" @@ -36,7 +37,8 @@ final class NotificationService: NSObject { // MARK: - Initialization - override init() { + init(settings: SettingsStore) { + self.settings = settings super.init() setupNotificationDelegate() registerNotificationCategories() @@ -183,6 +185,8 @@ final class NotificationService: NSObject { // MARK: - Private Methods private func openFolderInFinder(path: String) { + _ = settings.startAccessingOutputDirectory() + defer { settings.stopAccessingOutputDirectory() } let url = URL(filePath: path) NSWorkspace.shared.open(url) } diff --git a/BetterCapture/ViewModel/RecorderViewModel.swift b/BetterCapture/ViewModel/RecorderViewModel.swift index 6be6fb7..5d44eb5 100644 --- a/BetterCapture/ViewModel/RecorderViewModel.swift +++ b/BetterCapture/ViewModel/RecorderViewModel.swift @@ -97,7 +97,7 @@ final class RecorderViewModel { self.audioDeviceService = AudioDeviceService() self.cameraDeviceService = CameraDeviceService() self.previewService = PreviewService() - self.notificationService = NotificationService() + self.notificationService = NotificationService(settings: settings) self.permissionService = PermissionService() self.captureEngine = CaptureEngine() self.assetWriter = AssetWriter()