You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Jason Ginchereau (JIRA)" <ji...@apache.org> on 2016/03/02 00:05:18 UTC
[jira] [Commented] (CB-8708) copyTo error
[ https://issues.apache.org/jira/browse/CB-8708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15174589#comment-15174589 ]
Jason Ginchereau commented on CB-8708:
--------------------------------------
Error code 12 is PATH_EXISTS_ERR. See https://www.npmjs.com/package/cordova-plugin-file#list-of-error-codes-and-meanings
There's no overwrite flag on the copyTo API, so copying over an existing file will require deleting the existing file first.
> copyTo error
> -------------
>
> Key: CB-8708
> URL: https://issues.apache.org/jira/browse/CB-8708
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin File
> Environment: org.apache.cordova.file 1.3.4-dev "File" iOS
> Reporter: Rafael B
> Labels: iOS
>
> I found a new error, but now, IOS version.
> {code}
> var app = {};
> window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFileSystem, function() { console.log("3 "+JSON.stringify(rs));});
> function gotFileSystem(v) {
> app.fileSystem = v;
> var url = cordova.file.applicationDirectory+"www/1.jpg";
> window.resolveLocalFileSystemURL(url, function(entry) {
> var fullPath = cordova.file.applicationStorageDirectory;
> window.resolveLocalFileSystemURL(fullPath, function(entryDirectory) {
> entry.copyTo(entryDirectory, 'newfile.jpg', function(rs) {
> console.log(JSON.stringify(rs)); //success
> }, function() { console.log("1 "+JSON.stringify(rs));} ); //error code 12 in next test's.
> }, function() { console.log("2 "+JSON.stringify(rs));} );
> }, function() { console.log("3 "+JSON.stringify(rs));} );
> }
> {code}
> If execute first time, return success, but execute others time, return error (error code 12)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org