getunstuck_goodluck
getunstuck_goodluck

Reputation: 43

Electron: How do implement "open with" / have the "open-file" app event on MacOS called?

According to the documentation the following should do it:

app.on("open-file", (event, path) => {
    event.preventDefault();
    console.log("OPEN FILE???");
});    

The console log is never called. I have tried:

It might be quite significant how I build it too. I use electron-builder and have this in my package.json:

  "build": {
    "appId": "com.myname.someid",
    "mac": {
      "fileAssociations": [
        {
          "ext": [
            "mp3"
          ]
        }
      ]
    }
  }

Then I run electron-builder after installing it.

I have retested it in electron-quick-start and after following the above steps it still fails.

According to this tutorial this is also how you should do it:

https://roysegall.medium.com/electron-open-with-for-mac-osx-f215a1fe2ce1

Upvotes: 1

Views: 461

Answers (0)

Related Questions