Where to store user settings in Electron (Atom Shell) Application?

CodeManiak picture CodeManiak · May 26, 2015 · Viewed 51.2k times · Source

I can't seem to locate a built in mechanism to store user settings. I was hoping that electron provided a standard method for storing user settings across all desktop platforms. If there isn't a precedent for this I can implement it myself, I just didn't want to jump to a custom solution immediately. Research online is pretty sparse in this area. Thanks!

Answer

Josh picture Josh · Jun 3, 2015

Each platform has different default locations for different kinds of data. So, if you want to store data in default locations based on platform, check out app.getPath(name)

It retrieves a path to a special directory or file associated with name.

You can also use it to differentiate between data the user wants to save, and data your application saves that you don't want to clutter up users directories.

Or if you just want to store files reletive to a specific path you can use the app.setPath(name,path)