Skip to content Skip to sidebar Skip to footer

How Do I Make My Electron App The Default For Opening Files?

I am making an electron app with which the user can edit .txt files. I was wondering if it was possible to make the app the default app to open .txt files with... do I add somethin

Solution 1:

You'll want to look at the electron-builder config, specifically fileAssociations.

Nutshell:

fileAssociations allows setting ext, which you'd set to txt IIRC. You can also provide a descriptive name, give it icons, and several platform-specific options.


Unrelated, but this took about a minute of searching. For reference:

  1. Googled for "electron app make default for opening a type of files"
  2. Found an Electron issue that looked promising.
  3. Scrolled to a reference to electron-builder, which fit your question nicely.
  4. Made clicky on the links, made sure it was reasonable.
  5. Didn't test because on wrong laptop, but seems legit.

Post a Comment for "How Do I Make My Electron App The Default For Opening Files?"