Reputation: 1245
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 something to the packge.json? How do I handle the file? I know this question is sort of broad but I can not find anything in the docs so if I could be pointed in the right direction that would be great.
Other info:
Packaging: packaging with electron builder
Node: v12.14.1
npm: 6.14.1
Electron: 9.0.4
Upvotes: 0
Views: 1786
Reputation: 160170
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:
Upvotes: 1