diff options
Diffstat (limited to 'src/core/loader')
-rw-r--r-- | src/core/loader/loader.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index ce1154b79..1f895ed2e 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp @@ -28,22 +28,21 @@ FileType IdentifyFile(const std::string &filename) { } size_t extension_loc = filename.find_last_of('.'); - std::string extension = extension_loc != std::string::npos ? filename.substr(extension_loc) : ""; - - if (LowerStr(extension) == ".elf") { - return FileType::ELF; // TODO(bunnei): Do some filetype checking :p - } - else if (LowerStr(extension) == ".axf") { - return FileType::ELF; // TODO(bunnei): Do some filetype checking :p - } - else if (LowerStr(extension) == ".cxi") { - return FileType::CXI; // TODO(bunnei): Do some filetype checking :p - } - else if (LowerStr(extension) == ".cci") { - return FileType::CCI; // TODO(bunnei): Do some filetype checking :p - } - else if (LowerStr(extension) == ".bin") { - return FileType::BIN; // TODO(bunnei): Do some filetype checking :p + if (extension_loc == std::string::npos) + return FileType::Unknown; + std::string extension = Common::ToLower(filename.substr(extension_loc)); + + // TODO(bunnei): Do actual filetype checking instead of naively checking the extension + if (extension == ".elf") { + return FileType::ELF; + } else if (extension == ".axf") { + return FileType::ELF; + } else if (extension == ".cxi") { + return FileType::CXI; + } else if (extension == ".cci") { + return FileType::CCI; + } else if (extension == ".bin") { + return FileType::BIN; } return FileType::Unknown; } |