getFileSystemManager 的 rmdirSync BUG ?
发布于 5 年前 作者 yancao 15179 次浏览 来自 问答

getFileSystemManager 中 rmdirSync 的 dirPath 非常确定为 string 类型,但总会提示错误提示:

dirPat must be a string;at pages/index/index page lifeCycleMethod onLoad function Error: dirPat must be a string

是 BUG ? 还是我哪里写错了 ?

我的代码如下:

var fsm = wx.getFileSystemManager();

fsm.rmdirSync(

{

    dirPath:

‘’+

wx.env.USER_DATA_PATH + ‘/cp_icon/’,

    recursive: true, // 递归删除目录及其内部所有文件

    success:function(rs)

    {

        console.log(‘删除成功’);

        console.log(rs);

    },

    fail:function(e)

    {

        console.log(‘删除失败’);

        console.log(e);

    }

});

        

1 回复

fsm.rmdirSync(dirPath, …)

直接作为参数传进去,而不是放在 obj 里

回到顶部