FileSystemManager.mkdirSync
收藏我的收藏
基础库 1.15.0 开始支持本方法,这是一个同步方法。
在 用户目录 下创建目录。
前提条件 | 无 |
业务背景 | 无 |
使用限制 | 无 |
注意事项 | dirPath 必须以 ttfile://user 开头 |
相关教程 | 无 |
语法
FileSystemManager.mkdirSync(dirPath)
参数说明
dirPath
类型 | 默认值 | 必填 | 说明 | 最低支持 版本 |
---|---|---|---|---|
string | 是 | 创建的目录路径, 必须 ttfile://user 开头 | 1.15.0 |
返回值
无
错误码
errNo | errMsg | 说明 | 最低支持版本 |
---|---|---|---|
10401 | error stack | 小游戏框架内部错误,有需要请创建工单咨询 | 1.15.0 |
21101 | permission denied, $apiName $filePath | 1.15.0 | |
21102 | file already exists, $apiName $filePath | 1.15.0 | |
21103 | no such file or directory, $apiName $filePath | 1.15.0 | |
20001 | invalid param | 参数错误 | 1.15.0 |
20000 | params $paramName is required | 1.15.0 | |
20000 | params $paramName type is not $paramType type | 1.15.0 | |
20000 | $paramName is invalid | 1.15.0 | |
21104 | no such file or directory, $apiName $filePath | 小游戏框架内部错误,有需要请创建工单咨询 | 1.15.0 |
21103 | no such file or directory, $apiName $filePath | 小游戏框架内部错误,有需要请创建工单咨询 | 1.15.0 |
20000 | internal error | 小游戏框架内部错误,有需要请创建工单咨询 | 1.15.0 |
代码示例
const fileSystemManager = tt.getFileSystemManager(); try { fileSystemManager.mkdirSync("ttfile://user/some/path"); console.log("调用成功"); } catch (err) { console.log("调用失败", err); }