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

Unified Diff: base/file_path.cc

Issue 2831029: Add a method for normalizing path separators on Windows. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: a few more Created 10 years, 6 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/file_path.h ('k') | base/file_path_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_path.cc
diff --git a/base/file_path.cc b/base/file_path.cc
index d1a6371ceb1cd9a168da2d1f7d545ac935fc3082..0706a08ecda79f4e496e062a11c411b65fad0ca3 100644
--- a/base/file_path.cc
+++ b/base/file_path.cc
@@ -1124,3 +1124,12 @@ bool FilePath::ReferencesParent() const {
return false;
}
+#if defined(FILE_PATH_USES_WIN_SEPARATORS)
+FilePath FilePath::NormalizeWindowsPathSeparators() const {
+ StringType copy = path_;
+ for (size_t i = 1; i < arraysize(kSeparators); ++i) {
+ std::replace(copy.begin(), copy.end(), kSeparators[i], kSeparators[0]);
+ }
+ return FilePath(copy);
+}
+#endif
« no previous file with comments | « base/file_path.h ('k') | base/file_path_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698