OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <string.h> | 7 #include <string.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 // If the string only has two separators and they're at the beginning, | 1203 // If the string only has two separators and they're at the beginning, |
1204 // don't strip them, unless the string began with more than two separators. | 1204 // don't strip them, unless the string began with more than two separators. |
1205 if (pos != start + 1 || last_stripped == start + 2 || | 1205 if (pos != start + 1 || last_stripped == start + 2 || |
1206 !IsSeparator(path_[start - 1])) { | 1206 !IsSeparator(path_[start - 1])) { |
1207 path_.resize(pos - 1); | 1207 path_.resize(pos - 1); |
1208 last_stripped = pos; | 1208 last_stripped = pos; |
1209 } | 1209 } |
1210 } | 1210 } |
1211 } | 1211 } |
1212 | 1212 |
| 1213 FilePath FilePath::NormalizePathSeparators() const { |
1213 #if defined(FILE_PATH_USES_WIN_SEPARATORS) | 1214 #if defined(FILE_PATH_USES_WIN_SEPARATORS) |
1214 FilePath FilePath::NormalizeWindowsPathSeparators() const { | |
1215 StringType copy = path_; | 1215 StringType copy = path_; |
1216 for (size_t i = 1; i < arraysize(kSeparators); ++i) { | 1216 for (size_t i = 1; i < arraysize(kSeparators); ++i) { |
1217 std::replace(copy.begin(), copy.end(), kSeparators[i], kSeparators[0]); | 1217 std::replace(copy.begin(), copy.end(), kSeparators[i], kSeparators[0]); |
1218 } | 1218 } |
1219 return FilePath(copy); | 1219 return FilePath(copy); |
| 1220 #else |
| 1221 return *this; |
| 1222 #endif |
1220 } | 1223 } |
1221 #endif | |
OLD | NEW |