Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Unified Diff: base/files/file_path.h

Issue 863583002: Add FilePath::FinalExtension and RemoveFinalExtension (Closed) Base URL: https://chromium.googlesource.com/chromium/mini_chromium@master
Patch Set: simplify Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/files/file_path.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_path.h
diff --git a/base/files/file_path.h b/base/files/file_path.h
index feb5f896687fa3e01bff31f006ef179b6919d799..0ac91bf873a6275ad8713ef97d98fef730880538 100644
--- a/base/files/file_path.h
+++ b/base/files/file_path.h
@@ -147,6 +147,12 @@ class FilePath {
// A special path component meaning "this directory."
static const CharType kCurrentDirectory[];
+ // A special path component meaning "the parent directory."
+ static const CharType kParentDirectory[];
+
+ // The character used to identify a file extension.
+ static const CharType kExtensionSeparator;
+
FilePath();
FilePath(const FilePath& that);
explicit FilePath(const StringType& path);
@@ -184,6 +190,14 @@ class FilePath {
// this is the only situation in which BaseName will return an absolute path.
FilePath BaseName() const WARN_UNUSED_RESULT;
+ // Returns the path's file extension. This does not have a special case for
+ // common double extensions, so FinalExtension() of "foo.tar.gz" is simply
+ // ".gz". If there is no extension, "" will be returned.
+ StringType FinalExtension() const WARN_UNUSED_RESULT;
+
+ // Returns a FilePath with FinalExtension() removed.
+ FilePath RemoveFinalExtension() const WARN_UNUSED_RESULT;
+
// Returns a FilePath by appending a separator and the supplied path
// component to this object's path. Append takes care to avoid adding
// excessive separators if this object's path already ends with a separator.
« no previous file with comments | « no previous file | base/files/file_path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698