Closed amilajack closed 8 years ago
What problem are you trying to solve?
I'm trying to check if a configuration already exists. new Configstore()
will create a new store and I want to avoid that if I one was already created.
Configstore merges in the existing store, so no need to check.
I'm also trying to initialize some values upon creation. For example,
// Initialize config store values
if (configDoesNotExist) {
return new ConfigStore('popcorn-time-experimental', {
favorites: { items: [] },
recentlyWatched: { items: [] },
watchList: { items: [] },
state: {}
});
}
// Initialize config store values
else {
return new ConfigStore('popcorn-time-experimental');
}
That's what the defaults
option is for.
Thanks for clarifying!
Is there a proper, cross-platform way to check if the config file already exists?