Cordova 5 VS 2015。Android 应用无法创建文件夹
Cordova 5 VS 2015. Android App Can Not Create Folder
我更新到 VS 2015 和 Cordova 5。从那时起,我在使用 android 时无法再创建任何文件夹或文件。
没有抛出任何错误或任何可以帮助我解决这个问题的东西。
我正在尝试这个:
function onDeviceReady() {
window.requestFileSystem(window.PERSISTENT, 0, gotFS, fail);
}
function gotFS(fileSystem) {
fileSystem.root.getDirectory("mynewfolder", { create: true }, gotDir, fail);
console.log(fileSystem.root);
}
function gotDir(dirEntry) {
dirEntry.getFile("myfile.txt", { create: true, exclusive: true }, gotFile, fail);
}
function gotFile(fileEntry) {
// Do something with fileEntry here
}
function fail(error) {
console.log(error.code);
}
它说一切正常,文件夹已创建,但实际上没有。有什么帮助吗?
我强烈建议您使用 cordova file plugin。它允许您操作路径和文件夹,并防止在不同版本的 OS 或 cordova 中出错。
问题是通过 VS2015 添加插件无法正常工作。必须通过 CLI 添加它们
我更新到 VS 2015 和 Cordova 5。从那时起,我在使用 android 时无法再创建任何文件夹或文件。
没有抛出任何错误或任何可以帮助我解决这个问题的东西。
我正在尝试这个:
function onDeviceReady() {
window.requestFileSystem(window.PERSISTENT, 0, gotFS, fail);
}
function gotFS(fileSystem) {
fileSystem.root.getDirectory("mynewfolder", { create: true }, gotDir, fail);
console.log(fileSystem.root);
}
function gotDir(dirEntry) {
dirEntry.getFile("myfile.txt", { create: true, exclusive: true }, gotFile, fail);
}
function gotFile(fileEntry) {
// Do something with fileEntry here
}
function fail(error) {
console.log(error.code);
}
它说一切正常,文件夹已创建,但实际上没有。有什么帮助吗?
我强烈建议您使用 cordova file plugin。它允许您操作路径和文件夹,并防止在不同版本的 OS 或 cordova 中出错。
问题是通过 VS2015 添加插件无法正常工作。必须通过 CLI 添加它们