Hey there,
i got the same problem like @navdeepz with the cordova file plugin: i want to copy a directory from
cordova.file.applicationDirectory
file:///android_asset/www/algos/
to cordova.file.dataDirectory
file:///data/data/ch.paralgo.paralgo/files/algos/
it does not work accordingly and shows only error code 11 and type_mismatch. does anybody have a clue?
thanks for helping me out.
i tried to avoid the plugin by using only File-API specific command, with the same result.
thanks.
My Approach is this:
// device ready fired
if($cordovaFile){
// creating the file entry
var algoDirPath = cordova.file.dataDirectory + 'algos/';
var demoDirPath = cordova.file.applicationDirectory + 'www/algos/';
$cordovaFile.checkDir(cordova.file.dataDirectory, 'algos')
.then(function (success) {
console.log("protocol dir already there");
//check if demo is there
//
$cordovaFile.checkDir(algoDirPath, 'demo.algo')
.then(function(success){
//read the installed bundles
//TODO:
}, function(error){
//no demo installed, so install
console.log("no installed bundles, copy demo");
$cordovaFile.copyDir(demoDirPath, 'demo.algo', algoDirPath, 'demo.algo')
.then(function(sucess){
console.log("worked");
console.log(JSON.stringify(sucess));
}, function(error){
console.log("copy did not work");
console.log(JSON.stringify(error));
});
});
}, function (error) {
$cordovaFile.createDir(cordova.file.dataDirectory, "algos", false)
.then(function(success){
console.log("new protocol-dir created");
},function(error){
console.log("FATAL: could not create protocol dir");
});
});
output console:
installed plugins:
ionic info