| 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" |
| 6 |
| 7 #include <string.h> |
| 5 #include <algorithm> | 8 #include <algorithm> |
| 6 | 9 |
| 7 #include "base/file_path.h" | 10 #include "base/basictypes.h" |
| 8 | |
| 9 #if defined(OS_WIN) | |
| 10 #include <windows.h> | |
| 11 #elif defined(OS_MACOSX) | |
| 12 #include <CoreFoundation/CoreFoundation.h> | |
| 13 #endif | |
| 14 | |
| 15 #include "base/logging.h" | 11 #include "base/logging.h" |
| 16 #include "base/pickle.h" | 12 #include "base/pickle.h" |
| 17 | 13 |
| 18 // These includes are just for the *Hack functions, and should be removed | 14 // These includes are just for the *Hack functions, and should be removed |
| 19 // when those functions are removed. | 15 // when those functions are removed. |
| 20 #include "base/string_piece.h" | 16 #include "base/string_piece.h" |
| 21 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 22 #include "base/sys_string_conversions.h" | 18 #include "base/sys_string_conversions.h" |
| 23 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 24 | 20 |
| 25 #if defined(OS_MACOSX) | 21 #if defined(OS_MACOSX) |
| 26 #include "base/mac/scoped_cftyperef.h" | 22 #include "base/mac/scoped_cftyperef.h" |
| 27 #include "base/third_party/icu/icu_utf.h" | 23 #include "base/third_party/icu/icu_utf.h" |
| 28 #endif | 24 #endif |
| 29 | 25 |
| 26 #if defined(OS_WIN) |
| 27 #include <windows.h> |
| 28 #elif defined(OS_MACOSX) |
| 29 #include <CoreFoundation/CoreFoundation.h> |
| 30 #endif |
| 31 |
| 30 #if defined(FILE_PATH_USES_WIN_SEPARATORS) | 32 #if defined(FILE_PATH_USES_WIN_SEPARATORS) |
| 31 const FilePath::CharType FilePath::kSeparators[] = FILE_PATH_LITERAL("\\/"); | 33 const FilePath::CharType FilePath::kSeparators[] = FILE_PATH_LITERAL("\\/"); |
| 32 #else // FILE_PATH_USES_WIN_SEPARATORS | 34 #else // FILE_PATH_USES_WIN_SEPARATORS |
| 33 const FilePath::CharType FilePath::kSeparators[] = FILE_PATH_LITERAL("/"); | 35 const FilePath::CharType FilePath::kSeparators[] = FILE_PATH_LITERAL("/"); |
| 34 #endif // FILE_PATH_USES_WIN_SEPARATORS | 36 #endif // FILE_PATH_USES_WIN_SEPARATORS |
| 35 | 37 |
| 36 const FilePath::CharType FilePath::kCurrentDirectory[] = FILE_PATH_LITERAL("."); | 38 const FilePath::CharType FilePath::kCurrentDirectory[] = FILE_PATH_LITERAL("."); |
| 37 const FilePath::CharType FilePath::kParentDirectory[] = FILE_PATH_LITERAL(".."); | 39 const FilePath::CharType FilePath::kParentDirectory[] = FILE_PATH_LITERAL(".."); |
| 38 | 40 |
| 39 const FilePath::CharType FilePath::kExtensionSeparator = FILE_PATH_LITERAL('.'); | 41 const FilePath::CharType FilePath::kExtensionSeparator = FILE_PATH_LITERAL('.'); |
| (...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 | 1202 |
| 1201 #if defined(FILE_PATH_USES_WIN_SEPARATORS) | 1203 #if defined(FILE_PATH_USES_WIN_SEPARATORS) |
| 1202 FilePath FilePath::NormalizeWindowsPathSeparators() const { | 1204 FilePath FilePath::NormalizeWindowsPathSeparators() const { |
| 1203 StringType copy = path_; | 1205 StringType copy = path_; |
| 1204 for (size_t i = 1; i < arraysize(kSeparators); ++i) { | 1206 for (size_t i = 1; i < arraysize(kSeparators); ++i) { |
| 1205 std::replace(copy.begin(), copy.end(), kSeparators[i], kSeparators[0]); | 1207 std::replace(copy.begin(), copy.end(), kSeparators[i], kSeparators[0]); |
| 1206 } | 1208 } |
| 1207 return FilePath(copy); | 1209 return FilePath(copy); |
| 1208 } | 1210 } |
| 1209 #endif | 1211 #endif |
| OLD | NEW |