1 // Copyright 2012 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // FilePath is a container for pathnames stored in a platform's native string 6 // type, providing containers for manipulation in according with the 7 // platform's conventions for pathnames. It supports the following path 8 // types: 9 // 10 // POSIX Windows 11 // --------------- ---------------------------------- 12 // Fundamental type char[] wchar_t[] 13 // Encoding unspecified* UTF-16 14 // Separator / \, tolerant of / 15 // Drive letters no case-insensitive A-Z followed by : 16 // Alternate root // (surprise!) \\ (2 Separators), for UNC paths 17 // 18 // * The encoding need not be specified on POSIX systems, although some 19 // POSIX-compliant systems do specify an encoding. Mac OS X uses UTF-8. 20 // Chrome OS also uses UTF-8. 21 // Linux does not specify an encoding, but in practice, the locale's 22 // character set may be used. 23 // 24 // For more arcane bits of path trivia, see below. 25 // 26 // FilePath objects are intended to be used anywhere paths are. An 27 // application may pass FilePath objects around internally, masking the 28 // underlying differences between systems, only differing in implementation 29 // where interfacing directly with the system. For example, a single 30 // OpenFile(const FilePath &) function may be made available, allowing all 31 // callers to operate without regard to the underlying implementation. On 32 // POSIX-like platforms, OpenFile might wrap fopen, and on Windows, it might 33 // wrap _wfopen_s, perhaps both by calling file_path.value().c_str(). This 34 // allows each platform to pass pathnames around without requiring conversions 35 // between encodings, which has an impact on performance, but more imporantly, 36 // has an impact on correctness on platforms that do not have well-defined 37 // encodings for pathnames. 38 // 39 // Several methods are available to perform common operations on a FilePath 40 // object, such as determining the parent directory (DirName), isolating the 41 // final path component (BaseName), and appending a relative pathname string 42 // to an existing FilePath object (Append). These methods are highly 43 // recommended over attempting to split and concatenate strings directly. 44 // These methods are based purely on string manipulation and knowledge of 45 // platform-specific pathname conventions, and do not consult the filesystem 46 // at all, making them safe to use without fear of blocking on I/O operations. 47 // These methods do not function as mutators but instead return distinct 48 // instances of FilePath objects, and are therefore safe to use on const 49 // objects. The objects themselves are safe to share between threads. 50 // 51 // To aid in initialization of FilePath objects from string literals, a 52 // FILE_PATH_LITERAL macro is provided, which accounts for the difference 53 // between char[]-based pathnames on POSIX systems and wchar_t[]-based 54 // pathnames on Windows. 55 // 56 // As a precaution against premature truncation, paths can't contain NULs. 57 // 58 // Because a FilePath object should not be instantiated at the global scope, 59 // instead, use a FilePath::CharType[] and initialize it with 60 // FILE_PATH_LITERAL. At runtime, a FilePath object can be created from the 61 // character array. Example: 62 // 63 // | const FilePath::CharType kLogFileName[] = FILE_PATH_LITERAL("log.txt"); 64 // | 65 // | void Function() { 66 // | FilePath log_file_path(kLogFileName); 67 // | [...] 68 // | } 69 // 70 // WARNING: FilePaths should ALWAYS be displayed with LTR directionality, even 71 // when the UI language is RTL. This means you always need to pass filepaths 72 // through base::i18n::WrapPathWithLTRFormatting() before displaying it in the 73 // RTL UI. 74 // 75 // This is a very common source of bugs, please try to keep this in mind. 76 // 77 // ARCANE BITS OF PATH TRIVIA 78 // 79 // - A double leading slash is actually part of the POSIX standard. Systems 80 // are allowed to treat // as an alternate root, as Windows does for UNC 81 // (network share) paths. Most POSIX systems don't do anything special 82 // with two leading slashes, but FilePath handles this case properly 83 // in case it ever comes across such a system. FilePath needs this support 84 // for Windows UNC paths, anyway. 85 // References: 86 // The Open Group Base Specifications Issue 7, sections 3.267 ("Pathname") 87 // and 4.12 ("Pathname Resolution"), available at: 88 // http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_267 89 // http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_12 90 // 91 // - Windows treats c:\\ the same way it treats \\. This was intended to 92 // allow older applications that require drive letters to support UNC paths 93 // like \\server\share\path, by permitting c:\\server\share\path as an 94 // equivalent. Since the OS treats these paths specially, FilePath needs 95 // to do the same. Since Windows can use either / or \ as the separator, 96 // FilePath treats c://, c:\\, //, and \\ all equivalently. 97 // Reference: 98 // The Old New Thing, "Why is a drive letter permitted in front of UNC 99 // paths (sometimes)?", available at: 100 // http://blogs.msdn.com/oldnewthing/archive/2005/11/22/495740.aspx 101 102 #ifndef BASE_FILES_FILE_PATH_H_ 103 #define BASE_FILES_FILE_PATH_H_ 104 105 #include <cstddef> 106 #include <iosfwd> 107 #include <string> 108 #include <string_view> 109 #include <vector> 110 111 #include "base/base_export.h" 112 #include "base/strings/string_piece.h" 113 #include "base/trace_event/base_tracing_forward.h" 114 #include "build/build_config.h" 115 116 // Windows-style drive letter support and pathname separator characters can be 117 // enabled and disabled independently, to aid testing. These #defines are 118 // here so that the same setting can be used in both the implementation and 119 // in the unit test. 120 #if BUILDFLAG(IS_WIN) 121 #define FILE_PATH_USES_DRIVE_LETTERS 122 #define FILE_PATH_USES_WIN_SEPARATORS 123 #endif // BUILDFLAG(IS_WIN) 124 125 // To print path names portably use PRFilePath (based on PRIuS and friends from 126 // C99 and format_macros.h) like this: 127 // base::StringPrintf("Path is %" PRFilePath ".\n", path.value().c_str()); 128 #if BUILDFLAG(IS_WIN) 129 #define PRFilePath "ls" 130 #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) 131 #define PRFilePath "s" 132 #endif // BUILDFLAG(IS_WIN) 133 134 // Macros for string literal initialization of FilePath::CharType[]. 135 #if BUILDFLAG(IS_WIN) 136 137 // The `FILE_PATH_LITERAL_INTERNAL` indirection allows `FILE_PATH_LITERAL` to 138 // work correctly with macro parameters, for example 139 // `FILE_PATH_LITERAL(TEST_FILE)` where `TEST_FILE` is a macro #defined as 140 // "TestFile". 141 #define FILE_PATH_LITERAL_INTERNAL(x) L##x 142 #define FILE_PATH_LITERAL(x) FILE_PATH_LITERAL_INTERNAL(x) 143 144 #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) 145 #define FILE_PATH_LITERAL(x) x 146 #endif // BUILDFLAG(IS_WIN) 147 148 namespace base { 149 150 class SafeBaseName; 151 class Pickle; 152 class PickleIterator; 153 154 // An abstraction to isolate users from the differences between native 155 // pathnames on different platforms. 156 class BASE_EXPORT FilePath { 157 public: 158 #if BUILDFLAG(IS_WIN) 159 // On Windows, for Unicode-aware applications, native pathnames are wchar_t 160 // arrays encoded in UTF-16. 161 typedef std::wstring StringType; 162 #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) 163 // On most platforms, native pathnames are char arrays, and the encoding 164 // may or may not be specified. On Mac OS X, native pathnames are encoded 165 // in UTF-8. 166 typedef std::string StringType; 167 #endif // BUILDFLAG(IS_WIN) 168 169 typedef StringType::value_type CharType; 170 typedef std::basic_string_view<CharType> StringPieceType; 171 172 // Null-terminated array of separators used to separate components in paths. 173 // Each character in this array is a valid separator, but kSeparators[0] is 174 // treated as the canonical separator and is used when composing pathnames. 175 static constexpr CharType kSeparators[] = 176 #if defined(FILE_PATH_USES_WIN_SEPARATORS) 177 FILE_PATH_LITERAL("\\/"); 178 #else // FILE_PATH_USES_WIN_SEPARATORS 179 FILE_PATH_LITERAL("/"); 180 #endif // FILE_PATH_USES_WIN_SEPARATORS 181 182 // std::size(kSeparators), i.e., the number of separators in kSeparators plus 183 // one (the null terminator at the end of kSeparators). 184 static constexpr size_t kSeparatorsLength = std::size(kSeparators); 185 186 // The special path component meaning "this directory." 187 static constexpr CharType kCurrentDirectory[] = FILE_PATH_LITERAL("."); 188 189 // The special path component meaning "the parent directory." 190 static constexpr CharType kParentDirectory[] = FILE_PATH_LITERAL(".."); 191 192 // The character used to identify a file extension. 193 static constexpr CharType kExtensionSeparator = FILE_PATH_LITERAL('.'); 194 195 FilePath(); 196 FilePath(const FilePath& that); 197 explicit FilePath(StringPieceType path); 198 ~FilePath(); 199 FilePath& operator=(const FilePath& that); 200 201 // Constructs FilePath with the contents of |that|, which is left in valid but 202 // unspecified state. 203 FilePath(FilePath&& that) noexcept; 204 // Replaces the contents with those of |that|, which is left in valid but 205 // unspecified state. 206 FilePath& operator=(FilePath&& that) noexcept; 207 208 bool operator==(const FilePath& that) const; 209 210 bool operator!=(const FilePath& that) const; 211 212 // Required for some STL containers and operations 213 bool operator<(const FilePath& that) const { 214 return path_ < that.path_; 215 } 216 value()217 const StringType& value() const { return path_; } 218 empty()219 [[nodiscard]] bool empty() const { return path_.empty(); } 220 clear()221 void clear() { path_.clear(); } 222 223 // Returns true if |character| is in kSeparators. 224 static bool IsSeparator(CharType character); 225 226 // Returns a vector of all of the components of the provided path. It is 227 // equivalent to calling DirName().value() on the path's root component, 228 // and BaseName().value() on each child component. 229 // 230 // To make sure this is lossless so we can differentiate absolute and 231 // relative paths, the root slash will be included even though no other 232 // slashes will be. The precise behavior is: 233 // 234 // Posix: "/foo/bar" -> [ "/", "foo", "bar" ] 235 // Windows: "C:\foo\bar" -> [ "C:", "\\", "foo", "bar" ] 236 std::vector<FilePath::StringType> GetComponents() const; 237 238 // Returns true if this FilePath is a parent or ancestor of the |child|. 239 // Absolute and relative paths are accepted i.e. /foo is a parent to /foo/bar, 240 // and foo is a parent to foo/bar. Any ancestor is considered a parent i.e. /a 241 // is a parent to both /a/b and /a/b/c. Does not convert paths to absolute, 242 // follow symlinks or directory navigation (e.g. ".."). A path is *NOT* its 243 // own parent. 244 bool IsParent(const FilePath& child) const; 245 246 // If IsParent(child) holds, appends to path (if non-NULL) the 247 // relative path to child and returns true. For example, if parent 248 // holds "/Users/johndoe/Library/Application Support", child holds 249 // "/Users/johndoe/Library/Application Support/Google/Chrome/Default", and 250 // *path holds "/Users/johndoe/Library/Caches", then after 251 // parent.AppendRelativePath(child, path) is called *path will hold 252 // "/Users/johndoe/Library/Caches/Google/Chrome/Default". Otherwise, 253 // returns false. 254 bool AppendRelativePath(const FilePath& child, FilePath* path) const; 255 256 // Returns a FilePath corresponding to the directory containing the path 257 // named by this object, stripping away the file component. If this object 258 // only contains one component, returns a FilePath identifying 259 // kCurrentDirectory. If this object already refers to the root directory, 260 // returns a FilePath identifying the root directory. Please note that this 261 // doesn't resolve directory navigation, e.g. the result for "../a" is "..". 262 [[nodiscard]] FilePath DirName() const; 263 264 // Returns a FilePath corresponding to the last path component of this 265 // object, either a file or a directory. If this object already refers to 266 // the root directory, returns a FilePath identifying the root directory; 267 // this is the only situation in which BaseName will return an absolute path. 268 [[nodiscard]] FilePath BaseName() const; 269 270 // Returns the extension of a file path. This method works very similarly to 271 // FinalExtension(), except when the file path ends with a common 272 // double-extension. For common double-extensions like ".tar.gz" and 273 // ".user.js", this method returns the combined extension. 274 // 275 // Common means that detecting double-extensions is based on a hard-coded 276 // allow-list (including but not limited to ".*.gz" and ".user.js") and isn't 277 // solely dependent on the number of dots. Specifically, even if somebody 278 // invents a new Blah compression algorithm: 279 // - calling this function with "foo.tar.bz2" will return ".tar.bz2", but 280 // - calling this function with "foo.tar.blah" will return just ".blah" 281 // until ".*.blah" is added to the hard-coded allow-list. 282 // 283 // That hard-coded allow-list is case-insensitive: ".GZ" and ".gz" are 284 // equivalent. However, the StringType returned is not canonicalized for 285 // case: "foo.TAR.bz2" input will produce ".TAR.bz2", not ".tar.bz2", and 286 // "bar.EXT", which is not a double-extension, will produce ".EXT". 287 // 288 // The following code should always work regardless of the value of path. 289 // new_path = path.RemoveExtension().value().append(path.Extension()); 290 // ASSERT(new_path == path.value()); 291 // 292 // NOTE: this is different from the original file_util implementation which 293 // returned the extension without a leading "." ("jpg" instead of ".jpg"). 294 [[nodiscard]] StringType Extension() const; 295 296 // Returns the final extension of a file path, or an empty string if the file 297 // path has no extension. In most cases, the final extension of a file path 298 // refers to the part of the file path from the last dot to the end (including 299 // the dot itself). For example, this method applied to "/pics/jojo.jpg" 300 // and "/pics/jojo." returns ".jpg" and ".", respectively. However, if the 301 // base name of the file path is either "." or "..", this method returns an 302 // empty string. 303 // 304 // TODO(davidben): Check all our extension-sensitive code to see if 305 // we can rename this to Extension() and the other to something like 306 // LongExtension(), defaulting to short extensions and leaving the 307 // long "extensions" to logic like base::GetUniquePathNumber(). 308 [[nodiscard]] StringType FinalExtension() const; 309 310 // Returns "C:\pics\jojo" for path "C:\pics\jojo.jpg" 311 // NOTE: this is slightly different from the similar file_util implementation 312 // which returned simply 'jojo'. 313 [[nodiscard]] FilePath RemoveExtension() const; 314 315 // Removes the path's file extension, as in RemoveExtension(), but 316 // ignores double extensions. 317 [[nodiscard]] FilePath RemoveFinalExtension() const; 318 319 // Inserts |suffix| after the file name portion of |path| but before the 320 // extension. Returns "" if BaseName() == "." or "..". 321 // Examples: 322 // path == "C:\pics\jojo.jpg" suffix == " (1)", returns "C:\pics\jojo (1).jpg" 323 // path == "jojo.jpg" suffix == " (1)", returns "jojo (1).jpg" 324 // path == "C:\pics\jojo" suffix == " (1)", returns "C:\pics\jojo (1)" 325 // path == "C:\pics.old\jojo" suffix == " (1)", returns "C:\pics.old\jojo (1)" 326 [[nodiscard]] FilePath InsertBeforeExtension(StringPieceType suffix) const; 327 [[nodiscard]] FilePath InsertBeforeExtensionASCII(StringPiece suffix) const; 328 329 // Adds |extension| to |file_name|. Returns the current FilePath if 330 // |extension| is empty. Returns "" if BaseName() == "." or "..". 331 [[nodiscard]] FilePath AddExtension(StringPieceType extension) const; 332 333 // Like above, but takes the extension as an ASCII string. See AppendASCII for 334 // details on how this is handled. 335 [[nodiscard]] FilePath AddExtensionASCII(StringPiece extension) const; 336 337 // Replaces the extension of |file_name| with |extension|. If |file_name| 338 // does not have an extension, then |extension| is added. If |extension| is 339 // empty, then the extension is removed from |file_name|. 340 // Returns "" if BaseName() == "." or "..". 341 [[nodiscard]] FilePath ReplaceExtension(StringPieceType extension) const; 342 343 // Returns true if file path's Extension() matches `extension`. The test is 344 // case insensitive. Don't forget the leading period if appropriate. 345 bool MatchesExtension(StringPieceType extension) const; 346 347 // Returns true if file path's FinalExtension() matches `extension`. The 348 // test is case insensitive. Don't forget the leading period if appropriate. 349 bool MatchesFinalExtension(StringPieceType extension) const; 350 351 // Returns a FilePath by appending a separator and the supplied path 352 // component to this object's path. Append takes care to avoid adding 353 // excessive separators if this object's path already ends with a separator. 354 // If this object's path is kCurrentDirectory ('.'), a new FilePath 355 // corresponding only to |component| is returned. |component| must be a 356 // relative path; it is an error to pass an absolute path. 357 [[nodiscard]] FilePath Append(StringPieceType component) const; 358 [[nodiscard]] FilePath Append(const FilePath& component) const; 359 [[nodiscard]] FilePath Append(const SafeBaseName& component) const; 360 361 // Although Windows StringType is std::wstring, since the encoding it uses for 362 // paths is well defined, it can handle ASCII path components as well. 363 // Mac uses UTF8, and since ASCII is a subset of that, it works there as well. 364 // On Linux, although it can use any 8-bit encoding for paths, we assume that 365 // ASCII is a valid subset, regardless of the encoding, since many operating 366 // system paths will always be ASCII. 367 [[nodiscard]] FilePath AppendASCII(StringPiece component) const; 368 369 // Returns true if this FilePath contains an absolute path. On Windows, an 370 // absolute path begins with either a drive letter specification followed by 371 // a separator character, or with two separator characters. On POSIX 372 // platforms, an absolute path begins with a separator character. 373 bool IsAbsolute() const; 374 375 // Returns true if this FilePath is a network path which starts with 2 path 376 // separators. See class documentation for 'Alternate root'. 377 bool IsNetwork() const; 378 379 // Returns true if the patch ends with a path separator character. 380 [[nodiscard]] bool EndsWithSeparator() const; 381 382 // Returns a copy of this FilePath that ends with a trailing separator. If 383 // the input path is empty, an empty FilePath will be returned. 384 [[nodiscard]] FilePath AsEndingWithSeparator() const; 385 386 // Returns a copy of this FilePath that does not end with a trailing 387 // separator. 388 [[nodiscard]] FilePath StripTrailingSeparators() const; 389 390 // Returns true if this FilePath contains an attempt to reference a parent 391 // directory (e.g. has a path component that is ".."). 392 bool ReferencesParent() const; 393 394 // Return a Unicode human-readable version of this path. 395 // Warning: you can *not*, in general, go from a display name back to a real 396 // path. Only use this when displaying paths to users, not just when you 397 // want to stuff a std::u16string into some other API. 398 std::u16string LossyDisplayName() const; 399 400 // Return the path as ASCII, or the empty string if the path is not ASCII. 401 // This should only be used for cases where the FilePath is representing a 402 // known-ASCII filename. 403 std::string MaybeAsASCII() const; 404 405 // Return the path as UTF-8. 406 // 407 // This function is *unsafe* as there is no way to tell what encoding is 408 // used in file names on POSIX systems other than Mac and Chrome OS, 409 // although UTF-8 is practically used everywhere these days. To mitigate 410 // the encoding issue, this function internally calls 411 // SysNativeMBToWide() on POSIX systems other than Mac and Chrome OS, 412 // per assumption that the current locale's encoding is used in file 413 // names, but this isn't a perfect solution. 414 // 415 // Once it becomes safe to to stop caring about non-UTF-8 file names, 416 // the SysNativeMBToWide() hack will be removed from the code, along 417 // with "Unsafe" in the function name. 418 std::string AsUTF8Unsafe() const; 419 420 // Similar to AsUTF8Unsafe, but returns UTF-16 instead. 421 std::u16string AsUTF16Unsafe() const; 422 423 // Returns a FilePath object from a path name in ASCII. 424 static FilePath FromASCII(StringPiece ascii); 425 426 // Returns a FilePath object from a path name in UTF-8. This function 427 // should only be used for cases where you are sure that the input 428 // string is UTF-8. 429 // 430 // Like AsUTF8Unsafe(), this function is unsafe. This function 431 // internally calls SysWideToNativeMB() on POSIX systems other than Mac 432 // and Chrome OS, to mitigate the encoding issue. See the comment at 433 // AsUTF8Unsafe() for details. 434 static FilePath FromUTF8Unsafe(StringPiece utf8); 435 436 // Similar to FromUTF8Unsafe, but accepts UTF-16 instead. 437 static FilePath FromUTF16Unsafe(StringPiece16 utf16); 438 439 void WriteToPickle(Pickle* pickle) const; 440 bool ReadFromPickle(PickleIterator* iter); 441 442 // Normalize all path separators to backslash on Windows 443 // (if FILE_PATH_USES_WIN_SEPARATORS is true), or do nothing on POSIX systems. 444 [[nodiscard]] FilePath NormalizePathSeparators() const; 445 446 // Normalize all path separattors to given type on Windows 447 // (if FILE_PATH_USES_WIN_SEPARATORS is true), or do nothing on POSIX systems. 448 [[nodiscard]] FilePath NormalizePathSeparatorsTo(CharType separator) const; 449 450 // Compare two strings in the same way the file system does. 451 // Note that these always ignore case, even on file systems that are case- 452 // sensitive. If case-sensitive comparison is ever needed, add corresponding 453 // methods here. 454 // The methods are written as a static method so that they can also be used 455 // on parts of a file path, e.g., just the extension. 456 // CompareIgnoreCase() returns -1, 0 or 1 for less-than, equal-to and 457 // greater-than respectively. 458 static int CompareIgnoreCase(StringPieceType string1, 459 StringPieceType string2); CompareEqualIgnoreCase(StringPieceType string1,StringPieceType string2)460 static bool CompareEqualIgnoreCase(StringPieceType string1, 461 StringPieceType string2) { 462 return CompareIgnoreCase(string1, string2) == 0; 463 } CompareLessIgnoreCase(StringPieceType string1,StringPieceType string2)464 static bool CompareLessIgnoreCase(StringPieceType string1, 465 StringPieceType string2) { 466 return CompareIgnoreCase(string1, string2) < 0; 467 } 468 469 // Serialise this object into a trace. 470 void WriteIntoTrace(perfetto::TracedValue context) const; 471 472 #if BUILDFLAG(IS_APPLE) 473 // Returns the string in the special canonical decomposed form as defined for 474 // HFS, which is close to, but not quite, decomposition form D. See 475 // http://developer.apple.com/mac/library/technotes/tn/tn1150.html#UnicodeSubtleties 476 // for further comments. 477 // Returns the epmty string if the conversion failed. 478 static StringType GetHFSDecomposedForm(StringPieceType string); 479 480 // Special UTF-8 version of FastUnicodeCompare. Cf: 481 // http://developer.apple.com/mac/library/technotes/tn/tn1150.html#StringComparisonAlgorithm 482 // IMPORTANT: The input strings must be in the special HFS decomposed form! 483 // (cf. above GetHFSDecomposedForm method) 484 static int HFSFastUnicodeCompare(StringPieceType string1, 485 StringPieceType string2); 486 #endif 487 488 #if BUILDFLAG(IS_ANDROID) 489 // On android, file selection dialog can return a file with content uri 490 // scheme(starting with content://). Content uri needs to be opened with 491 // ContentResolver to guarantee that the app has appropriate permissions 492 // to access it. 493 // Returns true if the path is a content uri, or false otherwise. 494 bool IsContentUri() const; 495 #endif 496 497 // NOTE: When adding a new public method, consider adding it to 498 // file_path_fuzzer.cc as well. 499 500 private: 501 // Remove trailing separators from this object. If the path is absolute, it 502 // will never be stripped any more than to refer to the absolute root 503 // directory, so "////" will become "/", not "". A leading pair of 504 // separators is never stripped, to support alternate roots. This is used to 505 // support UNC paths on Windows. 506 void StripTrailingSeparatorsInternal(); 507 508 StringType path_; 509 }; 510 511 BASE_EXPORT std::ostream& operator<<(std::ostream& out, 512 const FilePath& file_path); 513 514 } // namespace base 515 516 namespace std { 517 518 template <> 519 struct hash<base::FilePath> { 520 typedef base::FilePath argument_type; 521 typedef std::size_t result_type; 522 result_type operator()(argument_type const& f) const { 523 return hash<base::FilePath::StringType>()(f.value()); 524 } 525 }; 526 527 } // namespace std 528 529 #endif // BASE_FILES_FILE_PATH_H_ 530