summaryrefslogtreecommitdiffstats
path: root/base/file_util.h
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-09 18:26:19 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-09 18:26:19 +0000
commit235c17a4631e92a4cbd214863758165a2f573801 (patch)
tree51a7a19215a774f558744e9cedd611a86dbd6ea7 /base/file_util.h
parent7d927f8c4baddd6d358bb7f47001e99cf757d65d (diff)
downloadchromium_src-235c17a4631e92a4cbd214863758165a2f573801.zip
chromium_src-235c17a4631e92a4cbd214863758165a2f573801.tar.gz
chromium_src-235c17a4631e92a4cbd214863758165a2f573801.tar.bz2
Add implementations of various extension related methods (derived from file_util):
Extension, RemoveExtension, InsertBeforeExtension, ReplaceExtension I didn't reimplement the old file_util ones since they actually modify the FilePath in place, which isn't the style of the rest of the FilePath methods. I'll file a cleanup bug after this for callers to switch to the new methods. Review URL: http://codereview.chromium.org/17243 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7811 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util.h')
-rw-r--r--base/file_util.h22
1 files changed, 9 insertions, 13 deletions
diff --git a/base/file_util.h b/base/file_util.h
index 784ea36..c064b2c 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -75,13 +75,12 @@ void TrimFilename(std::wstring* path);
// Deprecated. Use FilePath::BaseName instead.
std::wstring GetFilenameFromPath(const std::wstring& path);
-// Returns "jpg" for path "C:\pics\jojo.jpg", or an empty string if
-// the file has no extension.
+// Deprecated compatibility function. Use FilePath::Extension.
FilePath::StringType GetFileExtensionFromPath(const FilePath& path);
// Deprecated temporary compatibility function.
std::wstring GetFileExtensionFromPath(const std::wstring& path);
-// Returns 'jojo' for path "C:\pics\jojo.jpg".
+// Deprecated compatibility function. Use FilePath::RemoveExtension.
std::wstring GetFilenameWithoutExtensionFromPath(const std::wstring& path);
// Returns the directory component of a path, without the trailing
@@ -104,18 +103,15 @@ bool AbsolutePath(FilePath* path);
// Deprecated temporary compatibility function.
bool AbsolutePath(std::wstring* path);
-// Inserts |suffix| after the file name portion of |path| but before the
-// extension.
-// Examples:
-// path == "C:\pics\jojo.jpg" suffix == " (1)", returns "C:\pics\jojo (1).jpg"
-// path == "jojo.jpg" suffix == " (1)", returns "jojo (1).jpg"
-// path == "C:\pics\jojo" suffix == " (1)", returns "C:\pics\jojo (1)"
-// path == "C:\pics.old\jojo" suffix == " (1)", returns "C:\pics.old\jojo (1)"
+// Returns true if this FilePath represents a parent dir of |other|. Both
+// paths are normalized before doing the comparison, but neither |this| nor
+// |other| are modified.
+bool PathContains(const FilePath& path, const FilePath& other);
+
+// Deprecated compatibility function. Use FilePath::InsertBeforeExtension.
void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix);
-// Replaces the extension of |file_name| with |extension|. If |file_name|
-// does not have an extension, them |extension| is added. If |extension| is
-// empty, then the extension is removed from |file_name|.
+// Deprecated compatibility function. Use FilePath::ReplaceExtension.
void ReplaceExtension(FilePath* file_name,
const FilePath::StringType& extension);