Unity - A计划(永久有效期) 扫二维码继续学习 二维码时效为半小时

(196评价)
价格: 4049.00元
访问文件夹被拒绝
沧海一声笑发起了问答2020-06-04
1
回复
136
浏览

void WriteDataToLocalFile(string filePath, byte[] bytes)
    {
        if (File.Exists(filePath))
            File.Delete(filePath);

        using (FileStream fs = new FileStream(filePath, FileMode.Create))
        {
            fs.Write(bytes, 0, bytes.Length);
            fs.Close();
            fs.Dispose();
        }

        Debug.Log("写入完毕:" + filePath);
    }

 

用的这段代码写入文件,但是每次都提示filePath这个路径拒绝访问。错误提示:UnauthorizedAccessException: Access to the path'D:\UnityProject\FramWork\FramWork_Client_tolua\FrameWork_ClientTolua\Assets\StreamingAssets\NetAssetBundle' is denied.

以前还从来没遇到过这个问题,怎么解啊

所有回复
  • 老师_Trigger 2020-06-04

    同学你好,可以参考一下:

    https://tieba.baidu.com/p/5879612906?red_tag=3196287712

    https://blog.csdn.net/qq_15021025/article/details/78630487

    https://stackoverflow.com/questions/55422248/unity-unauthorizedaccessexception-access-to-the-path-is-denied

    还有-5条回复,点击查看
    你还没有登录,请先登录注册
发表回复
你还没有登录,请先 登录或 注册!