summaryrefslogtreecommitdiffstats
path: root/base/file_path.cc
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-25 05:33:17 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-25 05:33:17 +0000
commit7c37377a717a32501b8c07406a6ad8a0b7229240 (patch)
tree979bf47baa340e6d313210221aedd45ddb063205 /base/file_path.cc
parentb058597f786b4d1398bfa0cf4971bf7bb2b75c3b (diff)
downloadchromium_src-7c37377a717a32501b8c07406a6ad8a0b7229240.zip
chromium_src-7c37377a717a32501b8c07406a6ad8a0b7229240.tar.gz
chromium_src-7c37377a717a32501b8c07406a6ad8a0b7229240.tar.bz2
Add a method for normalizing path separators on Windows.
TEST=new unittests Review URL: http://codereview.chromium.org/2831029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50822 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_path.cc')
-rw-r--r--base/file_path.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/base/file_path.cc b/base/file_path.cc
index d1a6371..0706a08 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