OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 #include "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 | 7 |
8 // These includes are just for the *Hack functions, and should be removed | 8 // These includes are just for the *Hack functions, and should be removed |
9 // when those functions are removed. | 9 // when those functions are removed. |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 --pos) { | 445 --pos) { |
446 // If the string only has two separators and they're at the beginning, | 446 // If the string only has two separators and they're at the beginning, |
447 // don't strip them, unless the string began with more than two separators. | 447 // don't strip them, unless the string began with more than two separators. |
448 if (pos != start + 1 || last_stripped == start + 2 || | 448 if (pos != start + 1 || last_stripped == start + 2 || |
449 !IsSeparator(path_[start - 1])) { | 449 !IsSeparator(path_[start - 1])) { |
450 path_.resize(pos - 1); | 450 path_.resize(pos - 1); |
451 last_stripped = pos; | 451 last_stripped = pos; |
452 } | 452 } |
453 } | 453 } |
454 } | 454 } |
| 455 |
| 456 bool FilePath::ReferencesParent() const { |
| 457 std::vector<FilePath::StringType> components; |
| 458 GetComponents(&components); |
| 459 |
| 460 std::vector<FilePath::StringType>::const_iterator it = components.begin(); |
| 461 for (; it != components.end(); ++it) { |
| 462 const FilePath::StringType& component = *it; |
| 463 if (component == kParentDirectory) |
| 464 return true; |
| 465 } |
| 466 return false; |
| 467 } |
| 468 |
OLD | NEW |