小编Dav*_*nes的帖子

在Cordova中创建外部SDCard上的目录

我正在尝试在外部SDCard上创建一个目录.我能够在内部SD上这样做.下面的代码将返回错误代码12.我做错了什么?

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fs) {
            console.log("Root = " + fs.root.fullPath);
            fs.root.fullPath = cordova.file.externalRootDirectory;
            fs.root.getDirectory("newDir", {create: true, exclusive: false},
                function(dirEntry) {
                    dirEntry.getFile("newFile.txt", {create: true, exclusive: false}, function (fileEntry) {
                        console.log("File = " + fileEntry.fullPath);
                    }, function (error) {
                        alert(error.code);
                    });
                }, function (error) {
                   alert(error.code);
                });
           }, function (error) {
                   alert(error.code);
           });
Run Code Online (Sandbox Code Playgroud)

cordova

1
推荐指数
1
解决办法
2069
查看次数

标签 统计

cordova ×1