收藏
回答

微信截图的临时文件保存问题求解

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小游戏 Bug canvas.toTempFilePathSync 客户端 6.7.2 2.2.4

- 当前 Bug 的表现(可附上截图)


- 预期表现


- 复现路径


- 提供一个最简复现 Demo

let tempFilePath = cc.game.canvas.toTempFilePathSync({

x: 0,

y: 0,

width: 720,

height: 1280,

destWidth: 500,

destHeight: 400

});

cc.log(tempFilePath);

let fw = wx.getFileSystemManager();

let res = fw.copyFileSync(tempFilePath, `${wx.env.USER_DATA_PATH}/shotScreen.png`);

cc.log(res);

cc.log(`${wx.env.USER_DATA_PATH}/shotScreen.png`);


模拟器上log都有打印,res为空,其他有值

实机上(米max报错)

gameThirdScriptError

Uncaught Error: copyFileSync:fail no such file or directory, copyFile "bb1bbcd9-a33c-47bc-8043-254269810f84" -> "wxfile://usr/shotScreen.png"

Error: copyFileSync:fail no such file or directory, copyFile "bb1bbcd9-a33c-47bc-8043-254269810f84" -> "wxfile://usr/shotScreen.png"

at Object.ba [as copyFileSync] (WAGame.js:9:5122)

at a.emit (WAGame.js:7:13121)

at Tr.EventHandler.(anonymous function) (WAGame.js:11:24758)

at Object.<anonymous> (<anonymous>:133:17)

at <anonymous>:1:21


回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容