Cannot write to file due to permission?


Hi guys, so I am writing this app which has a ‘settings’ window that will show up when the user goes to Edit -> Preferences. On the window, there are select boxes in that page which let the user change the app’s settings and when the user clicks ‘Save’, a config.json file will be updated. In development mode, since the project’s folder is not inside a system folder (it’s inside ~/Projects/project-name/), I could open and save the settings just fine. But in production, since I need to install the app to the OS, I could open the settings but could not save the settings, the Console outputs Permission Denied. How can I fix this issue? Is there a better way to save user’s settings? Thanks in advance! :slight_smile:


Here is the link to the project I’m working on:
It’s a minimal Markdown editor and the ‘Settings’ window is in app/settings.html. It opens and updates the properties of config.json.


You’re attempting to write to the application installation directory, don’t. You should write settings to the directory returned by app.getPath('userData').


Oh okay, I’ll try to re-configure my app now, thanks for the reply :smiley: