diff options
author | hirono@chromium.org <hirono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 10:54:58 +0000 |
---|---|---|
committer | hirono@chromium.org <hirono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 10:54:58 +0000 |
commit | cf91ee2aaaf56dd683b6fa8de04fef4c2c6ef044 (patch) | |
tree | ffc01d946f6992a46899fdbb826919550bbc0481 | |
parent | 987b7663e835e908cafc9054ab554d6f9252adf7 (diff) | |
download | chromium_src-cf91ee2aaaf56dd683b6fa8de04fef4c2c6ef044.zip chromium_src-cf91ee2aaaf56dd683b6fa8de04fef4c2c6ef044.tar.gz chromium_src-cf91ee2aaaf56dd683b6fa8de04fef4c2c6ef044.tar.bz2 |
Files.app: Fixed a bug of moving multiple files.
In the situation that both a directory and its child item are moved, if the
directory is moved first, we will lose the child item because its path is
changed.
This CL make the copy items sorted so as that items in the deeper directories
moved faster than ones in the shallower directories.
BUG=230755
TEST=Enable moving from search results and test manually
Review URL: https://chromiumcodereview.appspot.com/15806002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201741 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/file_manager/js/file_copy_manager.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/chrome/browser/resources/file_manager/js/file_copy_manager.js b/chrome/browser/resources/file_manager/js/file_copy_manager.js index 5fc4f3b..b29bd49 100644 --- a/chrome/browser/resources/file_manager/js/file_copy_manager.js +++ b/chrome/browser/resources/file_manager/js/file_copy_manager.js @@ -89,7 +89,9 @@ FileCopyManager.Task.prototype.setEntries = function(entries, callback) { var self = this; var onEntriesRecursed = function(result) { - self.pendingDirectories = result.dirEntries; + // Deeper directory is moved earier. + self.pendingDirectories = result.dirEntries.sort( + function(a, b) { return a.fullPath < b.fullPath; }); self.pendingFiles = result.fileEntries; self.pendingBytes = result.fileBytes; callback(); @@ -109,16 +111,14 @@ FileCopyManager.Task.prototype.getNextEntry = function() { // We should keep the file in pending list and remove it after complete. // Otherwise, if we try to get status in the middle of copying. The returned // status is wrong (miss count the pasting item in totalItems). - if (this.pendingDirectories.length) { - this.pendingDirectories[0].inProgress = true; - return this.pendingDirectories[0]; - } - if (this.pendingFiles.length) { this.pendingFiles[0].inProgress = true; return this.pendingFiles[0]; } - + if (this.pendingDirectories.length) { + this.pendingDirectories[0].inProgress = true; + return this.pendingDirectories[0]; + } return null; }; |