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 // 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // system paths will always be ASCII. | 278 // system paths will always be ASCII. |
279 FilePath AppendASCII(const base::StringPiece& component) | 279 FilePath AppendASCII(const base::StringPiece& component) |
280 const WARN_UNUSED_RESULT; | 280 const WARN_UNUSED_RESULT; |
281 | 281 |
282 // Returns true if this FilePath contains an absolute path. On Windows, an | 282 // Returns true if this FilePath contains an absolute path. On Windows, an |
283 // absolute path begins with either a drive letter specification followed by | 283 // absolute path begins with either a drive letter specification followed by |
284 // a separator character, or with two separator characters. On POSIX | 284 // a separator character, or with two separator characters. On POSIX |
285 // platforms, an absolute path begins with a separator character. | 285 // platforms, an absolute path begins with a separator character. |
286 bool IsAbsolute() const; | 286 bool IsAbsolute() const; |
287 | 287 |
| 288 // Returns an absolute version of a relative path. Returns an empty path on |
| 289 // error. On POSIX, this function fails if the path does not exist. |
| 290 FilePath AsAbsolute() const WARN_UNUSED_RESULT; |
| 291 |
| 292 // Returns true if the patch ends with a path separator character. |
| 293 bool EndsWithSeparator() const WARN_UNUSED_RESULT; |
| 294 |
| 295 // Returns a copy of this FilePath that ends with a trailing separator. |
| 296 FilePath AsEndingWithSeparator() const WARN_UNUSED_RESULT; |
| 297 |
288 // Returns a copy of this FilePath that does not end with a trailing | 298 // Returns a copy of this FilePath that does not end with a trailing |
289 // separator. | 299 // separator. |
290 FilePath StripTrailingSeparators() const WARN_UNUSED_RESULT; | 300 FilePath StripTrailingSeparators() const WARN_UNUSED_RESULT; |
291 | 301 |
292 // Returns true if this FilePath contains any attempt to reference a parent | 302 // Returns true if this FilePath contains any attempt to reference a parent |
293 // directory (i.e. has a path component that is ".." | 303 // directory (i.e. has a path component that is ".." |
294 bool ReferencesParent() const; | 304 bool ReferencesParent() const; |
295 | 305 |
296 // Return a Unicode human-readable version of this path. | 306 // Return a Unicode human-readable version of this path. |
297 // Warning: you can *not*, in general, go from a display name back to a real | 307 // Warning: you can *not*, in general, go from a display name back to a real |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 | 443 |
434 inline size_t hash_value(const base::FilePath& f) { | 444 inline size_t hash_value(const base::FilePath& f) { |
435 return hash_value(f.value()); | 445 return hash_value(f.value()); |
436 } | 446 } |
437 | 447 |
438 #endif // COMPILER | 448 #endif // COMPILER |
439 | 449 |
440 } // namespace BASE_HASH_NAMESPACE | 450 } // namespace BASE_HASH_NAMESPACE |
441 | 451 |
442 #endif // BASE_FILES_FILE_PATH_H_ | 452 #endif // BASE_FILES_FILE_PATH_H_ |
OLD | NEW |