Chromium Code Reviews| Index: base/files/file_path.cc |
| diff --git a/base/files/file_path.cc b/base/files/file_path.cc |
| index 407ec855b2d7ad06273715e51313fb7275285f3c..79e9f054aafcdbcc6cdd6328dc90137d67cc8e6c 100644 |
| --- a/base/files/file_path.cc |
| +++ b/base/files/file_path.cc |
| @@ -16,6 +16,7 @@ |
| #include "base/string_piece.h" |
| #include "base/string_util.h" |
| #include "base/strings/sys_string_conversions.h" |
| +#include "base/threading/thread_restrictions.h" |
|
rvargas (doing something else)
2013/04/02 01:39:56
remove this.
|
| #include "base/utf_string_conversions.h" |
| #if defined(OS_MACOSX) |
| @@ -521,6 +522,24 @@ bool FilePath::IsAbsolute() const { |
| return IsPathAbsolute(path_); |
| } |
| +bool FilePath::EndsWithSeparator() const { |
| + if (empty()) |
| + return false; |
| + return IsSeparator(path_[path_.size() - 1]); |
| +} |
| + |
| +FilePath FilePath::AsEndingWithSeparator() const { |
| + if (EndsWithSeparator()) |
| + return *this; |
| + |
| + StringType path_str; |
| + path_str.reserve(path_.length() + 1); // Only allocate string once. |
| + |
| + path_str = path_; |
| + path_str.append(&kSeparators[0], 1); |
| + return FilePath(path_str); |
| +} |
| + |
| FilePath FilePath::StripTrailingSeparators() const { |
| FilePath new_path(path_); |
| new_path.StripTrailingSeparatorsInternal(); |