Chromium Code Reviews| Index: base/files/file_path.cc |
| diff --git a/base/files/file_path.cc b/base/files/file_path.cc |
| index d47becbacca30815ca1284a3aad2a2d229be16cd..37bcd4c8bec9899a67219b6dc8dd045ec3a80b0a 100644 |
| --- a/base/files/file_path.cc |
| +++ b/base/files/file_path.cc |
| @@ -1292,10 +1292,14 @@ void FilePath::StripTrailingSeparatorsInternal() { |
| } |
| FilePath FilePath::NormalizePathSeparators() const { |
| + return NormalizePathSeparatorsTo(kSeparators[0]); |
| +} |
| + |
| +FilePath FilePath::NormalizePathSeparatorsTo(CharType separator) const { |
| #if defined(FILE_PATH_USES_WIN_SEPARATORS) |
|
brettw
2014/04/02 17:34:28
How about DCHECKing here that separator == kSepara
scottmg
2014/04/02 20:20:19
Done.
|
| StringType copy = path_; |
| - for (size_t i = 1; i < kSeparatorsLength; ++i) { |
| - std::replace(copy.begin(), copy.end(), kSeparators[i], kSeparators[0]); |
| + for (size_t i = 0; i < kSeparatorsLength; ++i) { |
| + std::replace(copy.begin(), copy.end(), kSeparators[i], separator); |
| } |
| return FilePath(copy); |
| #else |