electron-userland / electron-json-storage

:package: Easily write and read user settings in Electron apps
1.44k stars 80 forks source link

Not storing values in windows platform #83

Closed arkakkar closed 7 years ago

arkakkar commented 7 years ago

Hi, electron-json-storage seems to work fine while working on a mac app, though on windows it does not create a particular storage json file under app.getPath('userData') directory. Could you help ? What am I doing wrong ? Sometimes also creating an empty json file. Have checked with the object I am setting to the key

jviotti commented 7 years ago

Hey there,

Do you have an actual error message? We test this module on Windows (using Appveyor CI), so I'm surprised it fails for you. Can you push the code somewhere I can take a look myself?

arkakkar commented 7 years ago

No I don't have an error message. It just empties the json file. I was trying to save to settings in the before-quit event. It seems to work fine on the mac platform. I have moved my code form before-quit handler to somewhere else and seems to be working fine now

jviotti commented 7 years ago

Weird. Let me know if it happens again, and try to build a small reproducible example that I can play around with.

bachdinhnhan commented 7 years ago

I have same problem with @arkakkar . Work fine on Mac platform but Window. No crash, just silence on Window. I try to debug to see what's wrong

bachdinhnhan commented 7 years ago

Test input

key: john6638@gmaildotcom value: an object

Result

Error: ENOENT: no such file or directory, open 'C:\Path To\storage\john6638%40gmaildotcom.json'

jviotti commented 7 years ago

I see. The issue is that an asterisk is not a valid character for paths on Windows (not the case on other UNIX operating systems). Let me see what I can do

bachdinhnhan commented 7 years ago

Thanks for your reply. I think that It will be fine to put a note on Readme

jviotti commented 7 years ago

@bachdinhnhan You're welcome! Check v3.1.1. It should work there!