Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Weird drag and drop with Electron app #33
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.
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!
Rich, thanks for the clues. Your guesses were all correct. ;-)