scripting / Scripting-News

I'm starting to use GitHub for work on my blog. Why not? It's got good communication and collaboration tools. Why not hook it up to a blog?
120 stars 10 forks source link

Weird drag and drop with Electron app #33

Open scripting opened 7 years ago

scripting commented 7 years ago

I want my Electron app to handle drag-and-drop from the desktop.

I want to drag an OPML file onto it, and have it open it.

I have done this before with Electron apps, for example Public Folder lets you drag a file onto it to upload it. It works.

In this case, it works when I'm debugging the app, but when I build the app, it launches the OPML Editor. This is so weird. When I drag an OPML file onto Chrome, it shows me the OPML source.

But when I do it with the browser inside Electron it opens it in the OPML Editor.

I figure I have something configured in the OS to make it do this, but I have no memory of doing it and no idea how it might have worked.

Any suggestions most welcome.

richb-hanover commented 7 years ago

I don't know for sure, but maybe this is a clue: What happens if you double-click the OPML file? Does OPML Editor open?

If so, perhaps Electron is responding to the Finder's Open With... attribute. To see that attribute, use Finder's Get Info on a ".opml" file. You'll see a section of the Info window with "Open with:" dropdown.

You can set this to tell the Finder always to open that file with the selected program. If you click "Change All...", it'll permanently open any file with that suffix using the selected program. Good luck!

scripting commented 7 years ago

Rich, thanks for the clues. Your guesses were all correct. ;-)

  1. When I double-click it does open the OPML Editor.

  2. When I did a Get Info, the popup menu does say open the OPML Editor.

  3. I tried changing it to my new app, but no luck -- the Finder no longer opens the OPML Editor but it opens the file in the browser, showing me the OPML as an XML file (which it is).