Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add App.open() method #309

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add App.open() method #309

wants to merge 1 commit into from

Conversation

nb
Copy link

@nb nb commented Jun 10, 2022

Opens a file with the default associated app, instead of launching an app. Useful to open files/directories via keyboard shortcuts. My specific use-case was to open my “Downloads” directory.

From developer interface standpoint, having those two methods makes sense, but I am happy to hear any feedback since we are increasing the API surface.

Implementation notes:

  • Since opening an .app file by default launches it, the App.launch() method uses this one internally. Based on the docs, it should work equally well.
  • Since the old code was using the deprecated launchApplicationAtURL, I used its counterpart, openURL. I am super new to Apple APIs, so decided to stick with what works, but I am happy to switch to something that's not deprecated. To be honest, I didn't have time to dig into the trade-offs of the various alternatives, like open.
  • We are losing a bit of fidelity in the error message, though it sounds acceptable to me.

Thank you for the great project :)

If the maintainers think the change makes sense, I am happy to add docs/changelog entry.

  • Updated related documentations
  • Added the change to the Changelog

Opens a file with the default associated app, instead of launching an
app. Useful to open files/directories via keyboard shortcuts.

Since opening an .app file by default launches it, the `App.launch()`
method uses this one internally.
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.

None yet

1 participant