Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3499)

Unified Diff: base/files/file_util_win.cc

Issue 2570693002: Fix base::CopyDirectory() and JumpListIcons(Old) folders' operation logic (Closed)
Patch Set: Fix deletion logic for JumpListIcon folder Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/win/jumplist.cc » ('j') | chrome/browser/win/jumplist.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_util_win.cc
diff --git a/base/files/file_util_win.cc b/base/files/file_util_win.cc
index d70454df3836a7067f71eecf5a0ae8673376f474..d1fc25f43cc0a86c8253731d387c7b2c5c6bf854 100644
--- a/base/files/file_util_win.cc
+++ b/base/files/file_util_win.cc
@@ -177,9 +177,16 @@ bool CopyDirectory(const FilePath& from_path, const FilePath& to_path,
FilePath real_from_path = MakeAbsoluteFilePath(from_path);
if (real_from_path.empty())
return false;
+ // Originally this CopyDirectory() returns false when |to_path| string
+ // contains |from_path| string. While this can be that the to_path is within
+ // the from_path, e.g., parent-child relationship if they are both folders, it
+ // also can be that the two paths are in the same folder, just that one name
+ // contains the other, e.g. C:\\JumpListIcon and C:\\JumpListIconOld.
gab 2016/12/13 21:31:21 s/JumpListIcon/Foo/ in example (since this is in /
chengx 2016/12/13 23:00:39 Done.
+ // We make this function not return false in the latter situation by calling
+ // IsParent() function as below. This allows the copy-n-delete code after the
+ // "return false" below to execute.
gab 2016/12/13 21:31:21 No need to describe history here IMO, just say: /
chengx 2016/12/13 23:00:39 Done.
if (real_to_path.value().size() >= real_from_path.value().size() &&
- real_to_path.value().compare(0, real_from_path.value().size(),
- real_from_path.value()) == 0) {
+ real_from_path.IsParent(real_to_path)) {
return false;
}
« no previous file with comments | « no previous file | chrome/browser/win/jumplist.cc » ('j') | chrome/browser/win/jumplist.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698