New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if opts.projectName is defined, prevent to read the pkgPath file #48
Comments
Sure, PR welcome, but really no point in having it in the Object.assign call at all then. Can just be: options = Object.assign({}, options);
if (!options.projectName) {
// Can't use `require` because of Webpack being annoying:
// https://github.com/webpack/webpack/issues/196
options.projectName = pkgPath && JSON.parse(fs.readFileSync(pkgPath, 'utf8')).name;
} |
Can you reproduce the issue reliably? Would be good to get that fixed for real instead of just hiding it away. |
Yeah, I also hope to fix the real problem, but it's hard for me to reproduce, because I only received this error report from one of the users. I will write down all things I knew so that we can discuss the possible bug. Here is the case:
Error message:
Here is how I declare the import Store from 'electron-store';
const store = new Store(); I think the possible reason is that pkgPath guess the wrong path. However, this is a special case. It only occurred in this user's case. |
Hi, I would like to suggest whether
conf
can prevent read the pkgPath file if theopts.projectName
is defined.Now the lib uses this way to set the
pkgPath
linkI think whether it can exam the option first?
The reason is I use the
electron-store
, and in some cases, I don't know why it loads the pkgPath as root system path (e.g.:/Users/<UserName>/pacakge.json
). This will cause the permission issues.If we can exam the projectName first, we can prevent the
conf
to automatically load the pkgPath.So the change would be:
The text was updated successfully, but these errors were encountered: