diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bd38e3..154f106 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- Fixed overly broad permission error detection that incorrectly reported file I/O errors as screen recording permission issues + - File permission errors (e.g., writing to `/System/`) now correctly report as `FILE_IO_ERROR` + - Directory not found errors provide clear messages about missing parent directories + - Added specific error code checking for ScreenCaptureKit and CoreGraphics APIs + - Only errors containing both "permission" and capture-related terms are now considered screen recording issues +- Enhanced file write error handling with pre-emptive directory checks +- Added debug logging to permission checker for diagnosing intermittent failures + ## [1.0.0-beta.19] - 2025-06-08 ### Added diff --git a/peekaboo-cli/Sources/peekaboo/PermissionsChecker.swift b/peekaboo-cli/Sources/peekaboo/PermissionsChecker.swift index 26fdb16..66d816e 100644 --- a/peekaboo-cli/Sources/peekaboo/PermissionsChecker.swift +++ b/peekaboo-cli/Sources/peekaboo/PermissionsChecker.swift @@ -9,6 +9,7 @@ class PermissionsChecker { // We check by attempting to get shareable content let semaphore = DispatchSemaphore(value: 0) var hasPermission = false + var capturedError: Error? Task { do { @@ -17,12 +18,18 @@ class PermissionsChecker { hasPermission = true } catch { // If we get an error, we don't have permission + capturedError = error hasPermission = false } semaphore.signal() } semaphore.wait() + + if let error = capturedError { + Logger.shared.debug("Screen recording permission check failed: \(error)") + } + return hasPermission }