Index: base/files/file_path.h |
diff --git a/base/files/file_path.h b/base/files/file_path.h |
index 33beb0b87039a0bad2169c938f86b62150bf5a19..f4b8ff8ade83b13da43a3ad0e071fce88a40edb3 100644 |
--- a/base/files/file_path.h |
+++ b/base/files/file_path.h |
@@ -224,18 +224,33 @@ class BASE_EXPORT FilePath { |
// Returns ".jpg" for path "C:\pics\jojo.jpg", or an empty string if |
// the file has no extension. If non-empty, Extension() will always start |
// with precisely one ".". The following code should always work regardless |
- // of the value of path. |
+ // of the value of path. For common double-extensions like .tar.gz and |
+ // .user.js, this method returns the combined extension. For a single |
+ // component, use FinalExtension(). |
// new_path = path.RemoveExtension().value().append(path.Extension()); |
// ASSERT(new_path == path.value()); |
// NOTE: this is different from the original file_util implementation which |
// returned the extension without a leading "." ("jpg" instead of ".jpg") |
StringType Extension() const; |
+ // Returns the path's file extension, as in Extension(), but will |
+ // never return a double extension. |
+ // |
+ // TODO(davidben): Check all our extension-sensitive code to see if |
+ // we can rename this to Extension() and the other to something like |
+ // LongExtension(), defaulting to short extensions and leaving the |
+ // long "extensions" to logic like file_util::GetUniquePathNumber(). |
+ StringType FinalExtension() const; |
+ |
// Returns "C:\pics\jojo" for path "C:\pics\jojo.jpg" |
// NOTE: this is slightly different from the similar file_util implementation |
// which returned simply 'jojo'. |
FilePath RemoveExtension() const WARN_UNUSED_RESULT; |
+ // Removes the path's file extension, as in RemoveExtension(), but |
+ // ignores double extensions. |
+ FilePath RemoveFinalExtension() const WARN_UNUSED_RESULT; |
+ |
// Inserts |suffix| after the file name portion of |path| but before the |
// extension. Returns "" if BaseName() == "." or "..". |
// Examples: |