codecamp

微信小游戏开发文档-小游戏文件API string FileSystemManager.renameSync(string oldPath, string newPath)

string FileSystemManager.renameSync(string oldPath, string newPath)

FileSystemManager.rename 的同步版本

参数

string oldPath

源文件路径,可以是普通文件或目录

string newPath

新文件路径

返回值

string errMsg

错误信息

errMsg 的合法值

值 说明
fail permission denied, rename ${oldPath} -> ${newPath} 指定源文件或目标文件没有写权限
fail no such file or directory, rename ${oldPath} -> ${newPath} 源文件不存在,或目标文件路径的上层目录不存在
微信小游戏开发文档-小游戏文件API Array.<string> FileSystemManager.readdirSync(string dirPath)
微信小游戏开发文档-小游戏文件API string FileSystemManager.readFileSync(string filePath, string encoding)
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

微信小游戏 API

微信小游戏API 系统

微信小游戏设备

微信小游戏API 文件

微信小游戏网络

微信小游戏API 界面

微信小游戏数据上报

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }