diff --git a/tests/test_files.py b/tests/test_files.py index 309d261..538542a 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -202,6 +202,11 @@ def fake_run(args, **kwargs): assert result["action"] == "reveal_in_finder" assert seen["args"][0] == "osascript" + # Finder's `reveal` needs an alias/file reference; a bare `POSIX file` + # specifier raises -1728 ("Can't get POSIX file ..."). Ensure we coerce. + script = " ".join(seen["args"]) + assert "as alias" in script + assert "reveal POSIX file (item 1 of argv)" not in script def test_get_finder_selection_parses_alias_output(monkeypatch): diff --git a/tools/files.py b/tools/files.py index a71069a..ff82116 100644 --- a/tools/files.py +++ b/tools/files.py @@ -470,7 +470,7 @@ def reveal_in_finder(path: str) -> str: script = ( 'on run argv\n' ' tell application "Finder"\n' - ' reveal POSIX file (item 1 of argv)\n' + ' reveal (POSIX file (item 1 of argv) as alias)\n' " activate\n" " end tell\n" "end run\n"