在微信开发者工具里的platform.js文件里,
调用了微信API:writeFile,向用户文件中写入信息。
fs = wx.getFileSystemManager()
writeFileData(fileName, info) {
console.log("[platform]writeFileData")
let myPath = `${wx.env.USER_DATA_PATH}/` + fileName;
var self = this;
return new Promise((resolve, reject) => {
self.fs.writeFile({
filePath: myPath,
data: info,
encoding: ‘utf8’,
success: (res) => {
console.log(res);
resolve(true);
},
fail: (res) => {
console.log(res.errMsg);
reject(false);
},
complete: () => {
console.log(“writeFileData complete”)
}
});
})
}
但是一直在报错:
platform.js? [sm]:261 writeFile:fail illegal operation on a directory, open http://usr/Littleman.txt
求助:这是怎么回事?已经登陆成功了,也授权成功了,使用mkdir成功创建了文件,然后使用writeFile向文件Littleman.txt里面写信息,但就是提示失败