Skip to content

fix(reveal_in_finder): coerce POSIX file to alias (-1728)#8

Open
curtisblanchette wants to merge 1 commit into
altic-dev:mainfrom
curtisblanchette:fix/reveal-in-finder-alias
Open

fix(reveal_in_finder): coerce POSIX file to alias (-1728)#8
curtisblanchette wants to merge 1 commit into
altic-dev:mainfrom
curtisblanchette:fix/reveal-in-finder-alias

Conversation

@curtisblanchette

Copy link
Copy Markdown

What

Fixes reveal_in_finder, which failed for every path (files and directories) with:

Finder got an error: Can't get POSIX file "/Users/.../code". (-1728)

Why

Finder's reveal command expects an alias/file reference. The script passed a bare
POSIX file (...) specifier, which Finder cannot resolve, so it raised -1728
("Can't get …") regardless of whether the path exists. open_app worked, confirming
Apple Events automation was authorized — the bug was purely in the AppleScript.

Change

- reveal POSIX file (item 1 of argv)
+ reveal (POSIX file (item 1 of argv) as alias)

The path is already existence-checked in Python before the script runs, so as alias
is safe.

Tests

  • Extended test_reveal_in_finder_uses_osascript to assert the script coerces to
    as alias and no longer uses the bare POSIX file form.
  • pytest tests/test_files.py → 14 passed.
  • Verified live on macOS 26.3.1 (arm64): the fixed script reveals the target and
    returns exit 0.

Fixes #7

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reveal_in_finder fails with -1728 ("Can't get POSIX file") for all paths

1 participant