| OLD | NEW |
| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 std::vector<StringType>::const_iterator it = components.begin(); | 506 std::vector<StringType>::const_iterator it = components.begin(); |
| 507 for (; it != components.end(); ++it) { | 507 for (; it != components.end(); ++it) { |
| 508 const StringType& component = *it; | 508 const StringType& component = *it; |
| 509 if (component == kParentDirectory) | 509 if (component == kParentDirectory) |
| 510 return true; | 510 return true; |
| 511 } | 511 } |
| 512 return false; | 512 return false; |
| 513 } | 513 } |
| 514 | 514 |
| 515 #if defined(OS_POSIX) | 515 #if defined(OS_POSIX) |
| 516 // See file_path.h for a discussion of the encoding of paths on POSIX |
| 517 // platforms. These encoding conversion functions are not quite correct. |
| 516 | 518 |
| 517 // See file_path.h for a discussion of the encoding of paths on POSIX | 519 string16 FilePath::LossyDisplayName() const { |
| 518 // platforms. These *Hack() functions are not quite correct, but they're | 520 return WideToUTF16(base::SysNativeMBToWide(path_)); |
| 519 // only temporary while we fix the remainder of the code. | 521 } |
| 522 |
| 523 // The *Hack functions are temporary while we fix the remainder of the code. |
| 520 // Remember to remove the #includes at the top when you remove these. | 524 // Remember to remove the #includes at the top when you remove these. |
| 521 | 525 |
| 522 // static | 526 // static |
| 523 FilePath FilePath::FromWStringHack(const std::wstring& wstring) { | 527 FilePath FilePath::FromWStringHack(const std::wstring& wstring) { |
| 524 return FilePath(base::SysWideToNativeMB(wstring)); | 528 return FilePath(base::SysWideToNativeMB(wstring)); |
| 525 } | 529 } |
| 526 std::wstring FilePath::ToWStringHack() const { | 530 std::wstring FilePath::ToWStringHack() const { |
| 527 return base::SysNativeMBToWide(path_); | 531 return base::SysNativeMBToWide(path_); |
| 528 } | 532 } |
| 529 #elif defined(OS_WIN) | 533 #elif defined(OS_WIN) |
| 534 string16 FilePath::LossyDisplayName() const { |
| 535 return path_; |
| 536 } |
| 537 |
| 530 // static | 538 // static |
| 531 FilePath FilePath::FromWStringHack(const std::wstring& wstring) { | 539 FilePath FilePath::FromWStringHack(const std::wstring& wstring) { |
| 532 return FilePath(wstring); | 540 return FilePath(wstring); |
| 533 } | 541 } |
| 534 std::wstring FilePath::ToWStringHack() const { | 542 std::wstring FilePath::ToWStringHack() const { |
| 535 return path_; | 543 return path_; |
| 536 } | 544 } |
| 537 #endif | 545 #endif |
| 538 | 546 |
| 539 // static. | 547 // static. |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 | 1195 |
| 1188 #if defined(FILE_PATH_USES_WIN_SEPARATORS) | 1196 #if defined(FILE_PATH_USES_WIN_SEPARATORS) |
| 1189 FilePath FilePath::NormalizeWindowsPathSeparators() const { | 1197 FilePath FilePath::NormalizeWindowsPathSeparators() const { |
| 1190 StringType copy = path_; | 1198 StringType copy = path_; |
| 1191 for (size_t i = 1; i < arraysize(kSeparators); ++i) { | 1199 for (size_t i = 1; i < arraysize(kSeparators); ++i) { |
| 1192 std::replace(copy.begin(), copy.end(), kSeparators[i], kSeparators[0]); | 1200 std::replace(copy.begin(), copy.end(), kSeparators[i], kSeparators[0]); |
| 1193 } | 1201 } |
| 1194 return FilePath(copy); | 1202 return FilePath(copy); |
| 1195 } | 1203 } |
| 1196 #endif | 1204 #endif |
| OLD | NEW |