ringa_lee2017-04-17 16:27:15
For configuration files, you can use electron-config.
You can also do it yourselffs
, and put the file under userData
高洛峰2017-04-17 16:27:15
I encountered that electron-config
was not automatically packaged during packaging and had to be copied manually - maybe my packaging configuration parameters were not written properly. electron-config
在打包的时候没有自动打包进去,要手动拷贝进去——可能是我的打包配置参数没写好。
后来用的nconf
nconf
later used🎜伊谢尔伦2017-04-17 16:27:15
This is how I dealt with this problem:
self.configFileName = "my.cfg";
if (self.platform === "darwin")
{
if (process.env.NODE_ENV === "production")
{
self.configFilePath = `${path.join(process.argv[0], "../../../../../..", self.configFileName)}`;
}
}
After publishing in this way, this config file will be stored in the program directory under win, and in the my.app directory under mac, which is at the same level as the Contents directory.