fix(reveal_in_finder): coerce POSIX file to alias (-1728)#8
Open
curtisblanchette wants to merge 1 commit into
Open
fix(reveal_in_finder): coerce POSIX file to alias (-1728)#8curtisblanchette wants to merge 1 commit into
curtisblanchette wants to merge 1 commit into
Conversation
Finder's `reveal` expects an alias/file reference. Passing a bare
`POSIX file` specifier makes Finder raise -1728 ("Can't get POSIX
file ...") for every path, so reveal_in_finder never worked.
Coerce to `as alias` (the path is already existence-checked in
Python). Add a test assertion covering the coercion.
Fixes altic-dev#7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes
reveal_in_finder, which failed for every path (files and directories) with:Why
Finder's
revealcommand expects an alias/file reference. The script passed a barePOSIX file (...)specifier, which Finder cannot resolve, so it raised-1728("Can't get …") regardless of whether the path exists.
open_appworked, confirmingApple Events automation was authorized — the bug was purely in the AppleScript.
Change
The path is already existence-checked in Python before the script runs, so
as aliasis safe.
Tests
test_reveal_in_finder_uses_osascriptto assert the script coerces toas aliasand no longer uses the barePOSIX fileform.pytest tests/test_files.py→ 14 passed.returns exit 0.
Fixes #7