electron-userland / electron-json-storage

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

Multi-Directory support #79

Closed Yoann-Pearson closed 7 years ago

Yoann-Pearson commented 7 years ago

Try number 2. I reapplied #51 on a recent fork of the master. Then applied requested modifications, added additional tests and did slight modifications in the functionality of the Getall and Keys functions to correctly support a different directory supplied as parameter.

Hopefully this time I can get it right!

jviotti commented 7 years ago

Sorry for taking so much time to get back to this. Thanks a lot for the PR, I'll update the docs and release a new version soon.

Yoann-Pearson commented 7 years ago

No problem! I noticed today that I missed 1 function (set with directory). I will do a PR later today with this, so you can have a complete multi-directory support for the new version.

jviotti commented 7 years ago

I think it makes more sense to have only the setter specify a directory. If you need to set settings elsewhere, you can change the data directory rather than passing a custom one on each function.

Yoann-Pearson commented 7 years ago

I suppose it depends on the usage. I could see a situation where you would want to write in 2 different directories. Since one call (writing) is asynch, but setting the directory is not, this could lead to unexpected results.

jviotti commented 7 years ago

I see, makes sense. Lets add an optional directory argument to all functions as a separate PR.