[jira] [Updated] (CB-6938) iOS File plugin: copyTo for file returns error when destination file exists
[ https://issues.apache.org/jira/browse/CB-6938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jason Ginchereau updated CB-6938: - Labels: iOS (was: ) > iOS File plugin: copyTo for file returns error when destination file exists > --- > > Key: CB-6938 > URL: https://issues.apache.org/jira/browse/CB-6938 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin File >Affects Versions: 3.5.0 > Environment: ios >Reporter: vldm >Assignee: Ian Clelland > Labels: iOS > > According to w3c spec: > A copy of a file on top of an existing file must attempt to delete and > replace that file. > iOS version of plugin in file CDVLocalFilesystem.m contains this code for the > case: > {code} > } else if (bNewExists) { > // the full destination should NOT already exist if a copy > errCode = PATH_EXISTS_ERR; > {code} > Suggested patch: > {code} > diff --git a/src/ios/CDVLocalFilesystem.m b/src/ios/CDVLocalFilesystem.m > index d1576ad..f5aa508 100644 > --- a/src/ios/CDVLocalFilesystem.m > +++ b/src/ios/CDVLocalFilesystem.m > @@ -535,11 +535,11 @@ > if (bSrcIsDir && ![self canCopyMoveSrc:srcFullPath > ToDestination:newFileSystemPath]) { > // can't copy dir into self > errCode = INVALID_MODIFICATION_ERR; > -} else if (bNewExists) { > -// the full destination should NOT already exist if a > copy > -errCode = PATH_EXISTS_ERR; > } else { > -bSuccess = [fileMgr copyItemAtPath:srcFullPath > toPath:newFileSystemPath error:&error]; > + bSuccess = YES; > +if (bNewExists) > +bSuccess = [fileMgr > removeItemAtPath:newFileSystemPath error:&error]; > +if (bSuccess) > +bSuccess = [fileMgr copyItemAtPath:srcFullPath > toPath:newFileSystemPath error:&error]; > } > } else { // move > // iOS requires that destination must not exist before > calling moveTo > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Updated] (CB-6938) iOS File plugin: copyTo for file returns error when destination file exists
[ https://issues.apache.org/jira/browse/CB-6938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ian Clelland updated CB-6938: - Description: According to w3c spec: A copy of a file on top of an existing file must attempt to delete and replace that file. iOS version of plugin in file CDVLocalFilesystem.m contains this code for the case: {code} } else if (bNewExists) { // the full destination should NOT already exist if a copy errCode = PATH_EXISTS_ERR; {code} Suggested patch: {code} diff --git a/src/ios/CDVLocalFilesystem.m b/src/ios/CDVLocalFilesystem.m index d1576ad..f5aa508 100644 --- a/src/ios/CDVLocalFilesystem.m +++ b/src/ios/CDVLocalFilesystem.m @@ -535,11 +535,11 @@ if (bSrcIsDir && ![self canCopyMoveSrc:srcFullPath ToDestination:newFileSystemPath]) { // can't copy dir into self errCode = INVALID_MODIFICATION_ERR; -} else if (bNewExists) { -// the full destination should NOT already exist if a copy -errCode = PATH_EXISTS_ERR; } else { -bSuccess = [fileMgr copyItemAtPath:srcFullPath toPath:newFileSystemPath error:&error]; + bSuccess = YES; +if (bNewExists) +bSuccess = [fileMgr removeItemAtPath:newFileSystemPath error:&error]; +if (bSuccess) +bSuccess = [fileMgr copyItemAtPath:srcFullPath toPath:newFileSystemPath error:&error]; } } else { // move // iOS requires that destination must not exist before calling moveTo {code} was: According to w3c spec: A copy of a file on top of an existing file must attempt to delete and replace that file. iOS version of plugin in file CDVLocalFilesystem.m contains this code for the case: } else if (bNewExists) { // the full destination should NOT already exist if a copy errCode = PATH_EXISTS_ERR; Suggested patch: diff --git a/src/ios/CDVLocalFilesystem.m b/src/ios/CDVLocalFilesystem.m index d1576ad..f5aa508 100644 --- a/src/ios/CDVLocalFilesystem.m +++ b/src/ios/CDVLocalFilesystem.m @@ -535,11 +535,11 @@ if (bSrcIsDir && ![self canCopyMoveSrc:srcFullPath ToDestination:newFileSystemPath]) { // can't copy dir into self errCode = INVALID_MODIFICATION_ERR; -} else if (bNewExists) { -// the full destination should NOT already exist if a copy -errCode = PATH_EXISTS_ERR; } else { -bSuccess = [fileMgr copyItemAtPath:srcFullPath toPath:newFileSystemPath error:&error]; + bSuccess = YES; +if (bNewExists) +bSuccess = [fileMgr removeItemAtPath:newFileSystemPath error:&error]; +if (bSuccess) +bSuccess = [fileMgr copyItemAtPath:srcFullPath toPath:newFileSystemPath error:&error]; } } else { // move // iOS requires that destination must not exist before calling moveTo > iOS File plugin: copyTo for file returns error when destination file exists > --- > > Key: CB-6938 > URL: https://issues.apache.org/jira/browse/CB-6938 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin File >Affects Versions: 3.5.0 > Environment: ios >Reporter: Vladimir Avdonin > > According to w3c spec: > A copy of a file on top of an existing file must attempt to delete and > replace that file. > iOS version of plugin in file CDVLocalFilesystem.m contains this code for the > case: > {code} > } else if (bNewExists) { > // the full destination should NOT already exist if a copy > errCode = PATH_EXISTS_ERR; > {code} > Suggested patch: > {code} > diff --git a/src/ios/CDVLocalFilesystem.m b/src/ios/CDVLocalFilesystem.m > index d1576ad..f5aa508 100644 > --- a/src/ios/CDVLocalFilesystem.m > +++ b/src/ios/CDVLocalFilesystem.m > @@ -535,11 +535,11 @@ > if (bSrcIsDir && ![self canCopyMoveSrc:srcFullPath > ToDestination:newFileSystemPath]) { > // can't copy dir into self > errCode = INVALID_MODIFICATION_ERR; > -} else if (bNewExists) { > -// the full destination should NOT already exist if a > copy > -errCode = PATH_EXISTS_ERR; > } else { > -bSuccess = [fileMgr copyItemAtPath:srcFullPath > toPath:newFileSystemPath error:&error]; > + bSucces
[jira] [Updated] (CB-6938) iOS File plugin: copyTo for file returns error when destination file exists
[ https://issues.apache.org/jira/browse/CB-6938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vladimir Avdonin updated CB-6938: - Description: According to w3c spec: A copy of a file on top of an existing file must attempt to delete and replace that file. iOS version of plugin in file CDVLocalFilesystem.m contains this code for the case: } else if (bNewExists) { // the full destination should NOT already exist if a copy errCode = PATH_EXISTS_ERR; Suggested patch: diff --git a/src/ios/CDVLocalFilesystem.m b/src/ios/CDVLocalFilesystem.m index d1576ad..f5aa508 100644 --- a/src/ios/CDVLocalFilesystem.m +++ b/src/ios/CDVLocalFilesystem.m @@ -535,11 +535,11 @@ if (bSrcIsDir && ![self canCopyMoveSrc:srcFullPath ToDestination:newFileSystemPath]) { // can't copy dir into self errCode = INVALID_MODIFICATION_ERR; -} else if (bNewExists) { -// the full destination should NOT already exist if a copy -errCode = PATH_EXISTS_ERR; } else { -bSuccess = [fileMgr copyItemAtPath:srcFullPath toPath:newFileSystemPath error:&error]; + bSuccess = YES; +if (bNewExists) +bSuccess = [fileMgr removeItemAtPath:newFileSystemPath error:&error]; +if (bSuccess) +bSuccess = [fileMgr copyItemAtPath:srcFullPath toPath:newFileSystemPath error:&error]; } } else { // move // iOS requires that destination must not exist before calling moveTo was: According to w3c spec: A copy of a file on top of an existing file must attempt to delete and replace that file. iOS version of plugin in file CDVLocalFilesystem.m contains this code for the case: } else if (bNewExists) { // the full destination should NOT already exist if a copy errCode = PATH_EXISTS_ERR; Suggested patch: diff --git a/src/ios/CDVLocalFilesystem.m b/src/ios/CDVLocalFilesystem.m index d1576ad..f5aa508 100644 --- a/src/ios/CDVLocalFilesystem.m +++ b/src/ios/CDVLocalFilesystem.m @@ -535,11 +535,11 @@ if (bSrcIsDir && ![self canCopyMoveSrc:srcFullPath ToDestination:newFileSystemPath]) { // can't copy dir into self errCode = INVALID_MODIFICATION_ERR; -} else if (bNewExists) { -// the full destination should NOT already exist if a copy -errCode = PATH_EXISTS_ERR; } else { -bSuccess = [fileMgr copyItemAtPath:srcFullPath toPath:newFileSystemPath error:&error]; +if (bNewExists) +bSuccess = [fileMgr removeItemAtPath:newFileSystemPath error:&error]; +if (bSuccess) +bSuccess = [fileMgr copyItemAtPath:srcFullPath toPath:newFileSystemPath error:&error]; } } else { // move // iOS requires that destination must not exist before calling moveTo > iOS File plugin: copyTo for file returns error when destination file exists > --- > > Key: CB-6938 > URL: https://issues.apache.org/jira/browse/CB-6938 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin File >Affects Versions: 3.5.0 > Environment: ios >Reporter: Vladimir Avdonin > > According to w3c spec: > A copy of a file on top of an existing file must attempt to delete and > replace that file. > iOS version of plugin in file CDVLocalFilesystem.m contains this code for the > case: > } else if (bNewExists) { > // the full destination should NOT already exist if a copy > errCode = PATH_EXISTS_ERR; > Suggested patch: > diff --git a/src/ios/CDVLocalFilesystem.m b/src/ios/CDVLocalFilesystem.m > index d1576ad..f5aa508 100644 > --- a/src/ios/CDVLocalFilesystem.m > +++ b/src/ios/CDVLocalFilesystem.m > @@ -535,11 +535,11 @@ > if (bSrcIsDir && ![self canCopyMoveSrc:srcFullPath > ToDestination:newFileSystemPath]) { > // can't copy dir into self > errCode = INVALID_MODIFICATION_ERR; > -} else if (bNewExists) { > -// the full destination should NOT already exist if a > copy > -errCode = PATH_EXISTS_ERR; > } else { > -bSuccess = [fileMgr copyItemAtPath:srcFullPath > toPath:newFileSystemPath error:&error]; > + bSuccess = YES; > +if (bNewExists) > +bSucce