You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by VinceOPS <gi...@git.apache.org> on 2017/07/20 13:13:29 UTC

[GitHub] cordova-plugin-file pull request #211: CB-6938: (fix) on iOS, copyTo should ...

GitHub user VinceOPS opened a pull request:

    https://github.com/apache/cordova-plugin-file/pull/211

    CB-6938: (fix) on iOS, copyTo should overwrite any existing file

    https://issues.apache.org/jira/browse/CB-6938
    
    ### Platforms affected
    iOS, all versions.
    
    ### What does this PR do?
    It fixes CB-6938.
    Instead of returning an error 12 (PATH_EXISTS_ERR), it tries to remove the existing file, then to copy the "new" one.
    
    ### What testing has been done on this change?
    Simulator: iPhone 5 and iPhone 6 @ iOS 9, 10.
    Real device: iPhone 5 @ iOS 10.
    
    No unit test provided nor written.
    
    ### Checklist
    - [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
    - [X] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
    - [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/VinceOPS/cordova-plugin-file CB-6938cordova-plugin-file

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-file/pull/211.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #211
    
----
commit 064c7f33e8d9b5dcee4f520e80a385336c9fcbc5
Author: VinceOPS <vi...@gmail.com>
Date:   2017-07-20T13:00:42Z

    iOS: (fix) copyTo should overwrite any existing file

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-file pull request #211: CB-6938: (fix) on iOS, copyTo should ...

Posted by filmaj <gi...@git.apache.org>.
Github user filmaj commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-file/pull/211#discussion_r128926981
  
    --- Diff: src/ios/CDVLocalFilesystem.m ---
    @@ -551,8 +551,13 @@ - (void)copyFileToURL:(CDVFilesystemURL *)destURL withName:(NSString *)newName f
                         // 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;
    +                    // first try to remove the existing file
    +                    bSuccess = [fileMgr removeItemAtPath:newFileSystemPath error:&error];
    +
    +                    if (bSuccess) {
    --- End diff --
    
    What should be done in the case removal of the item fails?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org