公司之前的一个nwjs的项目,需求改动,然后需要获取到用户信息缓存文件的文件路径,查了文档
找到了nwjs的方法 App.dataPath
项目中使用 var path=global.window.nwDispatcher.requireNwGui().App.dataPath;
但是我在使用中却出现报错xxxx 'requireNwGui()' of undefined 查了好久 找到下面这句话
nwDispatcher is undocumented API and will not be supported by NW 0.13. Please use require('nw.gui') or just nw
原因是我使用的新版本的nwjs对 nwDispatcher不再适用,于是直接require('nw.gui').App.dataPath 这样就能取到路径了