| Index: base/files/file_path.cc
|
| diff --git a/base/files/file_path.cc b/base/files/file_path.cc
|
| index de8927ac5b27c2b70a4117e243181be6c55860f1..5b8a60751d53f1c94281617fcfed2b83e9948276 100644
|
| --- a/base/files/file_path.cc
|
| +++ b/base/files/file_path.cc
|
| @@ -23,9 +23,7 @@
|
| #include "base/third_party/icu/icu_utf.h"
|
| #endif
|
|
|
| -#if defined(OS_WIN)
|
| -#include <windows.h>
|
| -#elif defined(OS_MACOSX)
|
| +#if defined(OS_MACOSX)
|
| #include <CoreFoundation/CoreFoundation.h>
|
| #endif
|
|
|
| @@ -421,11 +419,7 @@ FilePath FilePath::InsertBeforeExtension(const StringType& suffix) const {
|
| FilePath FilePath::InsertBeforeExtensionASCII(const StringPiece& suffix)
|
| const {
|
| DCHECK(IsStringASCII(suffix));
|
| -#if defined(OS_WIN)
|
| - return InsertBeforeExtension(ASCIIToUTF16(suffix.as_string()));
|
| -#elif defined(OS_POSIX)
|
| return InsertBeforeExtension(suffix.as_string());
|
| -#endif
|
| }
|
|
|
| FilePath FilePath::AddExtension(const StringType& extension) const {
|
| @@ -522,11 +516,7 @@ FilePath FilePath::Append(const FilePath& component) const {
|
|
|
| FilePath FilePath::AppendASCII(const StringPiece& component) const {
|
| DCHECK(base::IsStringASCII(component));
|
| -#if defined(OS_WIN)
|
| - return Append(ASCIIToUTF16(component.as_string()));
|
| -#elif defined(OS_POSIX)
|
| return Append(component.as_string());
|
| -#endif
|
| }
|
|
|
| bool FilePath::IsAbsolute() const {
|
| @@ -626,52 +616,15 @@ FilePath FilePath::FromUTF16Unsafe(const string16& utf16) {
|
| #endif
|
| }
|
|
|
| -#elif defined(OS_WIN)
|
| -string16 FilePath::LossyDisplayName() const {
|
| - return path_;
|
| -}
|
| -
|
| -std::string FilePath::MaybeAsASCII() const {
|
| - if (base::IsStringASCII(path_))
|
| - return UTF16ToASCII(path_);
|
| - return std::string();
|
| -}
|
| -
|
| -std::string FilePath::AsUTF8Unsafe() const {
|
| - return WideToUTF8(value());
|
| -}
|
| -
|
| -string16 FilePath::AsUTF16Unsafe() const {
|
| - return value();
|
| -}
|
| -
|
| -// static
|
| -FilePath FilePath::FromUTF8Unsafe(const std::string& utf8) {
|
| - return FilePath(UTF8ToWide(utf8));
|
| -}
|
| -
|
| -// static
|
| -FilePath FilePath::FromUTF16Unsafe(const string16& utf16) {
|
| - return FilePath(utf16);
|
| -}
|
| #endif
|
|
|
| void FilePath::WriteToPickle(Pickle* pickle) const {
|
| -#if defined(OS_WIN)
|
| - pickle->WriteString16(path_);
|
| -#else
|
| pickle->WriteString(path_);
|
| -#endif
|
| }
|
|
|
| bool FilePath::ReadFromPickle(PickleIterator* iter) {
|
| -#if defined(OS_WIN)
|
| - if (!iter->ReadString16(&path_))
|
| - return false;
|
| -#else
|
| if (!iter->ReadString(&path_))
|
| return false;
|
| -#endif
|
|
|
| if (path_.find(kStringTerminator) != StringType::npos)
|
| return false;
|
| @@ -679,36 +632,7 @@ bool FilePath::ReadFromPickle(PickleIterator* iter) {
|
| return true;
|
| }
|
|
|
| -#if defined(OS_WIN)
|
| -// Windows specific implementation of file string comparisons
|
| -
|
| -int FilePath::CompareIgnoreCase(const StringType& string1,
|
| - const StringType& string2) {
|
| - // Perform character-wise upper case comparison rather than using the
|
| - // fully Unicode-aware CompareString(). For details see:
|
| - // http://blogs.msdn.com/michkap/archive/2005/10/17/481600.aspx
|
| - StringType::const_iterator i1 = string1.begin();
|
| - StringType::const_iterator i2 = string2.begin();
|
| - StringType::const_iterator string1end = string1.end();
|
| - StringType::const_iterator string2end = string2.end();
|
| - for ( ; i1 != string1end && i2 != string2end; ++i1, ++i2) {
|
| - wchar_t c1 =
|
| - (wchar_t)LOWORD(::CharUpperW((LPWSTR)(DWORD_PTR)MAKELONG(*i1, 0)));
|
| - wchar_t c2 =
|
| - (wchar_t)LOWORD(::CharUpperW((LPWSTR)(DWORD_PTR)MAKELONG(*i2, 0)));
|
| - if (c1 < c2)
|
| - return -1;
|
| - if (c1 > c2)
|
| - return 1;
|
| - }
|
| - if (i1 != string1end)
|
| - return 1;
|
| - if (i2 != string2end)
|
| - return -1;
|
| - return 0;
|
| -}
|
| -
|
| -#elif defined(OS_MACOSX)
|
| +#if defined(OS_MACOSX)
|
| // Mac OS X specific implementation of file string comparisons
|
|
|
| // cf. http://developer.apple.com/mac/library/technotes/tn/tn1150.html#UnicodeSubtleties
|
|
|