summaryrefslogtreecommitdiffstats
path: root/base/file_path.h
diff options
context:
space:
mode:
authorrdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-25 01:53:44 +0000
committerrdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-25 01:53:44 +0000
commit922828b3ae178dc7c7985b96f54a540f1f22cc9f (patch)
tree3b47f2223d2f5416403d50ceeba76d2581386ebc /base/file_path.h
parent3ffb5e43d0996501ea2a3923c2e8c73dcf1d9b66 (diff)
downloadchromium_src-922828b3ae178dc7c7985b96f54a540f1f22cc9f.zip
chromium_src-922828b3ae178dc7c7985b96f54a540f1f22cc9f.tar.gz
chromium_src-922828b3ae178dc7c7985b96f54a540f1f22cc9f.tar.bz2
Add an AddExtension() method in FilePath
This provides an AddExtension() method in FilePath, which will append an extension to the FilePath. This provides clearer, more deliberate functionality than AppendASCII(), and allows us to add extensions without using ReplaceExtension, which will not work on files which already have extension (or appear to, e.g. temp files). BUG=NONE TEST=FilePathTest.AddExtension (added), previous FilePathTests. Review URL: http://codereview.chromium.org/10067002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133839 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_path.h')
-rw-r--r--base/file_path.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/base/file_path.h b/base/file_path.h
index 4d763eb..b90056b 100644
--- a/base/file_path.h
+++ b/base/file_path.h
@@ -242,8 +242,13 @@ 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(
+ 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(