我一直在尝试使用cordova 将名为versions.txt 的文件从applicationDirectory 复制到externalApplicationStorageDirectory,但代码失败。
这是代码
var path = cordova.file.applicationDirectory + "www/Data/versions.txt";
window.resolveLocalFileSystemURL(path,
function gotFile(fileEntry)
{
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
function onSuccess(fileSystem)
{
var directory = new DirectoryEntry("versions.txt", path);
fileEntry.copyTo(directory, 'versions.txt',
function()
{
alert('copying was successful')
},
function()
{
alert('unsuccessful copying')
});
}, null);
},null);
Run Code Online (Sandbox Code Playgroud)
有什么帮助吗?