Chromium Code Reviews| 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 // FilePath is a container for pathnames stored in a platform's native string | 5 // FilePath is a container for pathnames stored in a platform's native string |
| 6 // type, providing containers for manipulation in according with the | 6 // type, providing containers for manipulation in according with the |
| 7 // platform's conventions for pathnames. It supports the following path | 7 // platform's conventions for pathnames. It supports the following path |
| 8 // types: | 8 // types: |
| 9 // | 9 // |
| 10 // POSIX Windows | 10 // POSIX Windows |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 | 144 |
| 145 // A special path component meaning "this directory." | 145 // A special path component meaning "this directory." |
| 146 static const CharType kCurrentDirectory[]; | 146 static const CharType kCurrentDirectory[]; |
| 147 | 147 |
| 148 // A special path component meaning "the parent directory." | 148 // A special path component meaning "the parent directory." |
| 149 static const CharType kParentDirectory[]; | 149 static const CharType kParentDirectory[]; |
| 150 | 150 |
| 151 // The character used to identify a file extension. | 151 // The character used to identify a file extension. |
| 152 static const CharType kExtensionSeparator; | 152 static const CharType kExtensionSeparator; |
| 153 | 153 |
| 154 #if defined(OS_WIN) | |
| 155 // Path length is limited to 260 on Windows unless prefixed | |
| 156 // with a special extended path prefix. UNC needs a separate | |
| 157 // prefix containing "UNC" in it. | |
| 158 static const CharType kExtendedPathPrefix[]; | |
| 159 static const CharType kUNCExtendedPathPrefix[]; | |
| 160 // '\\' Prefix for network shares. | |
| 161 static const CharType kSharePrefix[]; | |
| 162 #endif | |
| 163 | |
| 154 FilePath(); | 164 FilePath(); |
| 155 FilePath(const FilePath& that); | 165 FilePath(const FilePath& that); |
| 156 explicit FilePath(const StringType& path); | 166 explicit FilePath(const StringType& path); |
| 157 ~FilePath(); | 167 ~FilePath(); |
| 158 FilePath& operator=(const FilePath& that); | 168 FilePath& operator=(const FilePath& that); |
| 159 | 169 |
| 160 bool operator==(const FilePath& that) const; | 170 bool operator==(const FilePath& that) const; |
| 161 | 171 |
| 162 bool operator!=(const FilePath& that) const; | 172 bool operator!=(const FilePath& that) const; |
| 163 | 173 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 FilePath::StringType* path); | 310 FilePath::StringType* path); |
| 301 | 311 |
| 302 void WriteToPickle(Pickle* pickle); | 312 void WriteToPickle(Pickle* pickle); |
| 303 bool ReadFromPickle(Pickle* pickle, void** iter); | 313 bool ReadFromPickle(Pickle* pickle, void** iter); |
| 304 | 314 |
| 305 #if defined(FILE_PATH_USES_WIN_SEPARATORS) | 315 #if defined(FILE_PATH_USES_WIN_SEPARATORS) |
| 306 // Normalize all path separators to backslash. | 316 // Normalize all path separators to backslash. |
| 307 FilePath NormalizeWindowsPathSeparators() const; | 317 FilePath NormalizeWindowsPathSeparators() const; |
| 308 #endif | 318 #endif |
| 309 | 319 |
| 320 #if defined(OS_WIN) | |
| 321 // This is an interim solution to support long paths on Windows. | |
| 322 StringType ToLongFileNameHack(const StringType& path) const; | |
|
kinuko
2010/12/22 23:20:49
If it's not called anywhere outside the class, can
Kavita Kanetkar
2010/12/23 03:14:28
Done.
| |
| 323 | |
| 324 // Gets the long form if it is in 8.3 file name format. Note that this | |
| 325 // is not supported for WinCE. | |
| 326 FilePath GetLongPathHack() const; | |
|
kinuko
2010/12/22 23:20:49
Can you put a comment that:
- this also prepends t
Kavita Kanetkar
2010/12/23 03:14:28
Done.
| |
| 327 #endif | |
| 328 | |
| 310 // Compare two strings in the same way the file system does. | 329 // Compare two strings in the same way the file system does. |
| 311 // Note that these always ignore case, even on file systems that are case- | 330 // Note that these always ignore case, even on file systems that are case- |
| 312 // sensitive. If case-sensitive comparison is ever needed, add corresponding | 331 // sensitive. If case-sensitive comparison is ever needed, add corresponding |
| 313 // methods here. | 332 // methods here. |
| 314 // The methods are written as a static method so that they can also be used | 333 // The methods are written as a static method so that they can also be used |
| 315 // on parts of a file path, e.g., just the extension. | 334 // on parts of a file path, e.g., just the extension. |
| 316 // CompareIgnoreCase() returns -1, 0 or 1 for less-than, equal-to and | 335 // CompareIgnoreCase() returns -1, 0 or 1 for less-than, equal-to and |
| 317 // greater-than respectively. | 336 // greater-than respectively. |
| 318 static int CompareIgnoreCase(const StringType& string1, | 337 static int CompareIgnoreCase(const StringType& string1, |
| 319 const StringType& string2); | 338 const StringType& string2); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 namespace stdext { | 401 namespace stdext { |
| 383 | 402 |
| 384 inline size_t hash_value(const FilePath& f) { | 403 inline size_t hash_value(const FilePath& f) { |
| 385 return hash_value(f.value()); | 404 return hash_value(f.value()); |
| 386 } | 405 } |
| 387 | 406 |
| 388 } // namespace stdext | 407 } // namespace stdext |
| 389 #endif // COMPILER | 408 #endif // COMPILER |
| 390 | 409 |
| 391 #endif // BASE_FILE_PATH_H_ | 410 #endif // BASE_FILE_PATH_H_ |
| OLD | NEW |