search

Home  >  Q&A  >  body text

node.js - Electron读写本地文件

PHP中文网PHP中文网2924 days ago776

reply all(4)I'll reply

  • ringa_lee

    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

    reply
    0
  • 高洛峰

    高洛峰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🎜

    reply
    0
  • 伊谢尔伦

    伊谢尔伦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.

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 16:27:15

    You can use node

    reply
    0
  • Cancelreply