为何fileManager.accessSync获取文件失败?
const fileManager = wx.getFileSystemManager();
try {
fileManager.accessSync('/env.txt');//这个文件放在项目根目录下
that.globalData.ENV = ENVS.DEV;
} catch (e) {
console.log(e)
that.globalData.ENV = ENVS.PROD;
}
报错
Error: accessSync:fail no such file or directory, access "/env.txt"
at accessSync (VM663 WAService.js:1)
at Object.e.<computed> [as accessSync] (VM663 WAService.js:1)
at pe.onLaunch (app.js? [sm]:32)
at pe.<anonymous> (VM663 WAService.js:1)
at VM663 WAService.js:1
at new pe (VM663 WAService.js:1)
at Function.<anonymous> (VM663 WAService.js:1)
at VM663 WAService.js:1
at app.js? [sm]:12
at require (VM663 WAService.js:1)