phoenix icon indicating copy to clipboard operation
phoenix copied to clipboard

Add App.open() method

Open nb opened this issue 3 years ago • 0 comments

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

nb avatar Jun 10 '22 13:06 nb