filename extension check should be case-insensitive

This commit is contained in:
David Rose 2011-03-14 20:09:06 +00:00
parent 0316dc67e3
commit 5f42b92027
1 changed files with 9 additions and 2 deletions

View File

@ -164,8 +164,15 @@ get_type_from_extension(const string &filename) const {
Extensions::const_iterator ei;
ei = _extensions.find(extension);
if (ei == _extensions.end() || (*ei).second.empty()) {
// Nothing matches that string.
return NULL;
// Nothing matches that string. Try again with a downcased string
// in case we got an all-uppercase filename (most of our
// extensions are downcased).
ei = _extensions.find(downcase(extension));
if (ei == _extensions.end() || (*ei).second.empty()) {
// Nothing matches that string.
return NULL;
}
}
// Return the first file type associated with the given extension.