Index: base/file_util_posix.cc |
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc |
index 7722a5e608bba2a19b0dd3d0c7b27104cee85766..35a96e726e79809d2b88fccf7b21432482da3848 100644 |
--- a/base/file_util_posix.cc |
+++ b/base/file_util_posix.cc |
@@ -345,13 +345,13 @@ bool CopyDirectory(const FilePath& from_path, |
while (success && !current.empty()) { |
// current is the source path, including from_path, so paste |
// the suffix after from_path onto to_path to create the target_path. |
brettw
2013/01/09 20:27:48
I think this comment is out-of-date now. Can you r
|
- std::string suffix(¤t.value().c_str()[from_path_base.value().size()]); |
- // Strip the leading '/' (if any). |
- if (!suffix.empty()) { |
- DCHECK_EQ('/', suffix[0]); |
- suffix.erase(0, 1); |
+ FilePath target_path(to_path); |
+ if (from_path_base != current) { |
+ if (!from_path_base.AppendRelativePath(current, &target_path)) { |
+ success = false; |
+ break; |
+ } |
} |
- const FilePath target_path = to_path.Append(suffix); |
if (S_ISDIR(info.stat.st_mode)) { |
if (mkdir(target_path.value().c_str(), info.stat.st_mode & 01777) != 0 && |