diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-29 20:31:29 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-29 20:31:29 +0000 |
commit | f1ce6e6c4d6bb08bd1534170b4647aabf8ff25ef (patch) | |
tree | 9166583bf968e8b0e780482823b2592fcade223f /base/file_path.cc | |
parent | 401392455919b47e7a85a20a058754e4b05da488 (diff) | |
download | chromium_src-f1ce6e6c4d6bb08bd1534170b4647aabf8ff25ef.zip chromium_src-f1ce6e6c4d6bb08bd1534170b4647aabf8ff25ef.tar.gz chromium_src-f1ce6e6c4d6bb08bd1534170b4647aabf8ff25ef.tar.bz2 |
Allow extension extensions to be case-insensitive.
BUG=none
TEST=try to load an extension with a capital letter or two in the extension's extension. It should load.
Review URL: http://codereview.chromium.org/147017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19520 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_path.cc')
-rw-r--r-- | base/file_path.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/base/file_path.cc b/base/file_path.cc index e3dfbbd..6712d70 100644 --- a/base/file_path.cc +++ b/base/file_path.cc @@ -284,6 +284,18 @@ FilePath FilePath::ReplaceExtension(const StringType& extension) const { return FilePath(str); } +bool FilePath::MatchesExtension(const StringType& extension) const { + FilePath::StringType current_extension = Extension(); + + if (current_extension.length() != extension.length()) + return false; + + return std::equal(extension.begin(), + extension.end(), + current_extension.begin(), + CaseInsensitiveCompare<FilePath::CharType>()); +} + FilePath FilePath::Append(const StringType& component) const { DCHECK(!IsPathAbsolute(component)); if (path_.compare(kCurrentDirectory) == 0) { |