Browse Source

AnyAudioImporter: lowercase() filename before recognizing suffix

pull/312/head
Max Schwarz 7 years ago
parent
commit
3d0e6c812b
  1. 8
      src/MagnumPlugins/AnyAudioImporter/AnyImporter.cpp

8
src/MagnumPlugins/AnyAudioImporter/AnyImporter.cpp

@ -47,13 +47,15 @@ void AnyImporter::doClose() { _in = nullptr; }
void AnyImporter::doOpenFile(const std::string& filename) { void AnyImporter::doOpenFile(const std::string& filename) {
CORRADE_INTERNAL_ASSERT(manager()); CORRADE_INTERNAL_ASSERT(manager());
std::string normalized = Utility::String::lowercase(filename);
/* Detect type from extension */ /* Detect type from extension */
std::string plugin; std::string plugin;
if(Utility::String::endsWith(filename, ".ogg")) if(Utility::String::endsWith(normalized, ".ogg"))
plugin = "VorbisAudioImporter"; plugin = "VorbisAudioImporter";
else if(Utility::String::endsWith(filename, ".wav")) else if(Utility::String::endsWith(normalized, ".wav"))
plugin = "WavAudioImporter"; plugin = "WavAudioImporter";
else if(Utility::String::endsWith(filename, ".flac")) else if(Utility::String::endsWith(normalized, ".flac"))
plugin = "FlacAudioImporter"; plugin = "FlacAudioImporter";
else { else {
Error() << "Audio::AnyImporter::openFile(): cannot determine type of file" << filename; Error() << "Audio::AnyImporter::openFile(): cannot determine type of file" << filename;

Loading…
Cancel
Save