Chromium Code Reviews| 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..629658447d848b53630c2638d4ae478990ba498b 100644 |
| --- a/base/files/file_util_win.cc |
| +++ b/base/files/file_util_win.cc |
| @@ -177,9 +177,10 @@ bool CopyDirectory(const FilePath& from_path, const FilePath& to_path, |
| FilePath real_from_path = MakeAbsoluteFilePath(from_path); |
| if (real_from_path.empty()) |
| return false; |
| + // Note: it's important to use IsParent() here as string comparison would |
|
grt (UTC plus 2)
2016/12/15 09:23:55
nit: i think this comment is unnecessary. the File
|
| + // result in a false negative, e.g. on C:\bar\Foo versus C:\bar\FooOld. |
| if (real_to_path.value().size() >= real_from_path.value().size() && |
|
grt (UTC plus 2)
2016/12/15 09:23:55
this "optimization" seems wrong to me -- either a
|
| - real_to_path.value().compare(0, real_from_path.value().size(), |
| - real_from_path.value()) == 0) { |
| + real_from_path.IsParent(real_to_path)) { |
|
grt (UTC plus 2)
2016/12/15 09:23:55
please make this same fix in file_util_posix
|
| return false; |
| } |