sveinbjornt / Platypus

Create native Mac applications from command line scripts.
https://sveinbjorn.org/platypus
BSD 3-Clause "New" or "Revised" License
2.84k stars 171 forks source link

triggering custom protocol - sometimes the association is lost #265

Open npup opened 10 months ago

npup commented 10 months ago

Hi!

I found this app a few days ago and was immediately impressed and very happy with it, truly a sweet thing!

I bundled a nodejs script which downloads a file and then opens it in a suitable application on the computer. But that is just plain nodejs code, nothing special.. the script was triggered by clicking links like pp://example.pdf on my testing web page via the protocol association, and also of course worked fine when run directly from the terminal as a node script.

At one point, after tweaking the script itself and building a new MyHandler.app - and replacing it in the /Applications directory - the message when clicking links is

Failed to launch 'pp://example.pdf' because the scheme does not have a registered handler.

with pp:// being my protocol, as entered in the list of URI Schemes in Platypus. I checked all the settings, rebuilt, redeployed (meaning removing the app from /Applications and putting the fresh one there) but I seemed stuck with having lost the protocol association. A while later, I gave it a go again, just filling everything out (name, script type, script src, URI Scheme), and for some reason it started working :/

The next day, it was gone again - "no registered handler" for pp://.

I realize this may not be a problem with Platypus itself, but possibly someone knows why fluctuations like this would be happening. The Internet had some related advice along the lines of refreshing the plists like defaults read org.something.MyHandler which haven't helped in my case. I also restarted the computer in case something had stuck.

If I inspect a built app, and see reasonable plists (in fact having entries for the wanted protocol/s), what can I do to reliably make the Mac be aware of those protocols? This may be the real question but I am not sure - hence the long text :)

Best regards /

Edit: I use version Version 5.4.1 (1240), from Homebrew