更新时间:2023-10-10 22:57:52
这些是promise,你是否使用它们:
$ cordovaFile.checkDir(cordova.file。 dataDirectory,inbounds)
.then(function(success){
// success
alert(status+ success);
},function(error){
// error
});您是否已经配置了config.xml了吗?
$ p> < preference name =iosExtraFilesystemsvalue =library,library-nosync,documents,documents-nosync,cache,bundle,root/>
< preference name =AndroidExtraFilesystemsvalue =files,external,documents,sdcard,cache,cache-external,root/>
I am trying to work with the ngCordova File plugin as documented here: http://ngcordova.com/docs/plugins/file/, but am getting strange behaviour.
I am trying to create a folder if it does not already exist. I am testing for its existence using:
$cordovaFile.checkDir(cordova.file.dataDirectory, 'inbound')
Now this returns NOT_FOUND_ERR
so i try to create the folder subsequently by calling:
$cordovaFile.createDir(cordova.file.dataDirectory, 'inbound', false);
But this then returns PATH_EXISTS_ERR
Why would checkDir tell me it does not exist, but then createDir tell me it DOES exist?
NOTE: This is using an Android device.
Those are promises, are you using them like that :
$cordovaFile.checkDir(cordova.file.dataDirectory, "inbounds")
.then(function (success) {
// success
alert("status " + success);
}, function (error) {
// error
});
Have you configured your config.xml too ?
<preference name="iosExtraFilesystems" value="library,library-nosync,documents,documents-nosync,cache,bundle,root" />
<preference name="AndroidExtraFilesystems" value="files,files-external,documents,sdcard,cache,cache-external,root" />