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

Unified Diff: base/files/file_path.cc

Issue 213353004: GN: Move towards only using / on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: restore convert_slashes in output path, misc fixes Created 6 years, 9 months 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 | « base/files/file_path.h ('k') | tools/gn/build_settings.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_path.cc
diff --git a/base/files/file_path.cc b/base/files/file_path.cc
index d47becbacca30815ca1284a3aad2a2d229be16cd..f5a9e5a0c3c5f24b9b11ff2bbebbb28fddb462c9 100644
--- a/base/files/file_path.cc
+++ b/base/files/file_path.cc
@@ -1292,10 +1292,16 @@ void FilePath::StripTrailingSeparatorsInternal() {
}
FilePath FilePath::NormalizePathSeparators() const {
+ return NormalizePathSeparatorsTo(kSeparators[0]);
+}
+
+FilePath FilePath::NormalizePathSeparatorsTo(CharType separator) const {
#if defined(FILE_PATH_USES_WIN_SEPARATORS)
+ DCHECK_NE(kSeparators + kSeparatorsLength,
+ std::find(kSeparators, kSeparators + kSeparatorsLength, separator));
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
« no previous file with comments | « base/files/file_path.h ('k') | tools/gn/build_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698