是啊,我是用的writeStringToFile这个,写不进去啊,什么报错都没有
安卓给写入权限了吗
我现在只想写入本地文件,但写不进去
import { _decorator, Component, native} from ‘cc’;
import { NATIVE } from ‘cc/env’;
//const { fileUtils } = native;
const { ccclass, property } = _decorator;
@ccclass(‘NewComponent_001’)
export class NewComponent_001 extends Component {
start() {
let str:string="ddd";
if(NATIVE){
native.fileUtils.writeStringToFile(str,"D:/lll.txt")
}
}
update(deltaTime: number) {
}
}
你构建在哪个平台测的
用浏览器测的
刚才又用VScode运行了一下 还是不行
浏览器不行
那是预览干不了,你要构建编译成安卓或者windows才能用
浏览器环境不叫原生
哦,那如果我想在开发阶段读写一个电脑里的JSON文件,有没有办法呢
写html的js让用户拖个文件进去在开始你就能取到哪个文件的数据
