I\'ve been trying to copy file named versions.txt from applicationDirectory to externalApplicationStorageDirectory using cordova but code fails.
here is the code
Served my source code to the PhoneGap developer app. My file copy code is below.
//COPY FILE
var wwwDirEntry;
//resolve url for directory entry for putting in copied file
window.resolveLocalFileSystemURL(cordova.file.dataDirectory+'phonegapdevapp/www/', function success(dirEntry) {
wwwDirEntry = dirEntry;
});
//resolve file URL to file entry to enable copying
//
//Desired URL: file:///data/user/0/com.adobe.phonegap.app/files/phonegapdevapp/www/my_awesome_file.doc
//BASE URL: cordova.file.dataDirectory / file:///data/user/0/com.adobe.phonegap.app/files/
//
//alert(JSON.stringify(cordova.file.dataDirectory));
//
window.resolveLocalFileSystemURL(cordova.file.dataDirectory+'phonegapdevapp/www/my_awesome_file.doc',
function onSuccess(fileEntry)
{
//alert(JSON.stringify(fileEntry));
fileEntry.copyTo(wwwDirEntry, 'a_copy_of_my_awesome_file.doc',
function()
{
alert('copying was successful');
},
function()
{
alert('copying FAILED');
});
}, function (e) { alert(JSON.stringify(e)); });