You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Tom Good (JIRA)" <ji...@apache.org> on 2014/09/19 19:54:34 UTC

[jira] [Updated] (CB-7602) isCopyOnItself check fails when moving directory

     [ https://issues.apache.org/jira/browse/CB-7602?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom Good updated CB-7602:
-------------------------
    Description: 
When using moveTo to move a directory the isCopyOnItself check fails if the directory name starts the same but is different.  Example:

Source:
/storage/emulated/0/GalileoMobile
Destination:
/storage/emulated/0/GalileoMobileBackup/GalileoMobile

The issue is with the indexof check looking for any slash.
Existing Line 305 of LocalFileSystem.java:
        if (dest.startsWith(src) && dest.indexOf(File.separator, src.length() - 1) != -1) {

Something like this should work:
      if (dest.equals(src) || dest.startsWith(src + File.separator) ) {

This would also occur with copies.

  was:
When using moveTo to move a directory the isCopyOnItself check fails if the directory name starts the same.  Example:

Source:
/storage/emulated/0/GalileoMobile
Destination:
/storage/emulated/0/GalileoMobileBackup/GalileoMobile

The issue is with the indexof check looking for any slash.
Existing Line 305 of LocalFileSystem.java:
        if (dest.startsWith(src) && dest.indexOf(File.separator, src.length() - 1) != -1) {

Something like this should work:
      if (dest.equals(src) || dest.startsWith(src + File.separator) ) {

This would also occur with copies.


> isCopyOnItself check fails when moving directory
> ------------------------------------------------
>
>                 Key: CB-7602
>                 URL: https://issues.apache.org/jira/browse/CB-7602
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, Plugin File
>    Affects Versions: 3.5.0
>            Reporter: Tom Good
>            Priority: Minor
>              Labels: copyTo, moveTo
>
> When using moveTo to move a directory the isCopyOnItself check fails if the directory name starts the same but is different.  Example:
> Source:
> /storage/emulated/0/GalileoMobile
> Destination:
> /storage/emulated/0/GalileoMobileBackup/GalileoMobile
> The issue is with the indexof check looking for any slash.
> Existing Line 305 of LocalFileSystem.java:
>         if (dest.startsWith(src) && dest.indexOf(File.separator, src.length() - 1) != -1) {
> Something like this should work:
>       if (dest.equals(src) || dest.startsWith(src + File.separator) ) {
> This would also occur with copies.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)