| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // File utilities that use the ICU library go in this file. | 5 // File utilities that use the ICU library go in this file. |
| 6 | 6 |
| 7 #include "base/i18n/file_util_icu.h" | 7 #include "base/i18n/file_util_icu.h" |
| 8 | 8 |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 collator->setStrength(icu::Collator::TERTIARY); | 157 collator->setStrength(icu::Collator::TERTIARY); |
| 158 | 158 |
| 159 #if defined(OS_WIN) | 159 #if defined(OS_WIN) |
| 160 return CompareString16WithCollator(*collator, WideToUTF16(a.value()), | 160 return CompareString16WithCollator(*collator, WideToUTF16(a.value()), |
| 161 WideToUTF16(b.value())) == UCOL_LESS; | 161 WideToUTF16(b.value())) == UCOL_LESS; |
| 162 | 162 |
| 163 #elif defined(OS_POSIX) | 163 #elif defined(OS_POSIX) |
| 164 // On linux, the file system encoding is not defined. We assume | 164 // On linux, the file system encoding is not defined. We assume |
| 165 // SysNativeMBToWide takes care of it. | 165 // SysNativeMBToWide takes care of it. |
| 166 return CompareString16WithCollator( | 166 return CompareString16WithCollator( |
| 167 *collator, WideToUTF16(SysNativeMBToWide(a.value().c_str())), | 167 *collator, WideToUTF16(SysNativeMBToWide(a.value())), |
| 168 WideToUTF16(SysNativeMBToWide(b.value().c_str()))) == UCOL_LESS; | 168 WideToUTF16(SysNativeMBToWide(b.value()))) == UCOL_LESS; |
| 169 #else | 169 #else |
| 170 #error Not implemented on your system | 170 #error Not implemented on your system |
| 171 #endif | 171 #endif |
| 172 } | 172 } |
| 173 | 173 |
| 174 void NormalizeFileNameEncoding(FilePath* file_name) { | 174 void NormalizeFileNameEncoding(FilePath* file_name) { |
| 175 #if defined(OS_CHROMEOS) | 175 #if defined(OS_CHROMEOS) |
| 176 std::string normalized_str; | 176 std::string normalized_str; |
| 177 if (ConvertToUtf8AndNormalize(file_name->BaseName().value(), | 177 if (ConvertToUtf8AndNormalize(file_name->BaseName().value(), |
| 178 kCodepageUTF8, | 178 kCodepageUTF8, |
| 179 &normalized_str)) { | 179 &normalized_str)) { |
| 180 *file_name = file_name->DirName().Append(FilePath(normalized_str)); | 180 *file_name = file_name->DirName().Append(FilePath(normalized_str)); |
| 181 } | 181 } |
| 182 #endif | 182 #endif |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace i18n | 185 } // namespace i18n |
| 186 } // namespace base | 186 } // namespace base |
| OLD | NEW |