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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « base/file_path.h ('k') | base/file_path_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_path.h" 5 #include "base/file_path.h"
6 6
7 #if defined(OS_MACOSX) 7 #if defined(OS_MACOSX)
8 #include <CoreServices/CoreServices.h> 8 #include <CoreServices/CoreServices.h>
9 #endif 9 #endif
10 10
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 1117
1118 std::vector<FilePath::StringType>::const_iterator it = components.begin(); 1118 std::vector<FilePath::StringType>::const_iterator it = components.begin();
1119 for (; it != components.end(); ++it) { 1119 for (; it != components.end(); ++it) {
1120 const FilePath::StringType& component = *it; 1120 const FilePath::StringType& component = *it;
1121 if (component == kParentDirectory) 1121 if (component == kParentDirectory)
1122 return true; 1122 return true;
1123 } 1123 }
1124 return false; 1124 return false;
1125 } 1125 }
1126 1126
1127 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
1128 FilePath FilePath::NormalizeWindowsPathSeparators() const {
1129 StringType copy = path_;
1130 for (size_t i = 1; i < arraysize(kSeparators); ++i) {
1131 std::replace(copy.begin(), copy.end(), kSeparators[i], kSeparators[0]);
1132 }
1133 return FilePath(copy);
1134 }
1135 #endif
OLDNEW
« 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