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

Unified Diff: base/file_path.h

Issue 10067002: Add an AddExtension() method in FilePath (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 8 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/file_path.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_path.h
diff --git a/base/file_path.h b/base/file_path.h
index 4d763eb394c1cca1eb11225a753a185f05e0c947..eb7279846a347413f858e9522cebd86a3f80b12c 100644
--- a/base/file_path.h
+++ b/base/file_path.h
@@ -242,13 +242,21 @@ class BASE_EXPORT FilePath {
FilePath InsertBeforeExtensionASCII(
const base::StringPiece& suffix) const WARN_UNUSED_RESULT;
+ // Adds |extension| to |file_name|. Returns the current FilePath if
+ // |extension| is empty. Returns "" if BaseName() == "." or "..".
+ FilePath AddExtension(
Mark Mentovai 2012/04/16 15:54:45 It’s hard to see why you need to use this without
Devlin 2012/04/17 21:52:49 The most common instance I've encountered is when
+ const StringType& extension) const WARN_UNUSED_RESULT;
+
// Replaces the extension of |file_name| with |extension|. If |file_name|
- // does not have an extension, them |extension| is added. If |extension| is
+ // does not have an extension, then |extension| is added. If |extension| is
// empty, then the extension is removed from |file_name|.
// Returns "" if BaseName() == "." or "..".
FilePath ReplaceExtension(
const StringType& extension) const WARN_UNUSED_RESULT;
+ // Returns true if BaseName() is "", ".", or "..".
+ bool IsBaseEmptyOrSpecialCase() const;
Mark Mentovai 2012/04/16 15:54:45 Why do you need to expose this?
Devlin 2012/04/17 21:52:49 My original thought was that these instances are f
Mark Mentovai 2012/04/18 20:02:21 D Cronin wrote:
Devlin 2012/04/19 00:05:42 Done.
+
// Returns true if the file path matches the specified extension. The test is
// case insensitive. Don't forget the leading period if appropriate.
bool MatchesExtension(const StringType& extension) const;
« no previous file with comments | « no previous file | base/file_path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698