收藏
回答

使用WX.env.USER_DATA_PATH的创建文件失败?

使用该环境变量去创建文件失败,提示:The file did not exist and failed to be created, msg=path must be a string。

输出打印的地址是:文件路径是:http://usr/player_data.txt

this._filePath = string.Format("{0}/{1}.txt", WX.env.USER_DATA_PATH, "player_data");
Error($"文件路径是:{this._filePath}");
if (_fs.AccessSync(this._filePath) != "ok")
{
    var result = _fs.WriteFileSync(this._filePath, defaultBytes);
    if (result != "ok")
    {
        Error($"The file did not exist and failed to be created, msg={result}");
    }
}
回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容