summaryrefslogtreecommitdiffstats
path: root/src/core/loader/loader.cpp
diff options
context:
space:
mode:
authorarchshift <admin@archshift.com>2014-09-07 20:50:43 +0200
committerarchshift <admin@archshift.com>2014-09-09 00:43:22 +0200
commit5472fd4d9b19011a36604a9c7f9c66f3ebe84e3f (patch)
treeb55a6013b561cbb1986a04f2154fe18c0774e891 /src/core/loader/loader.cpp
parentloader.cpp: improved file extension checking, made Upper/LowerStr useful (diff)
downloadyuzu-5472fd4d9b19011a36604a9c7f9c66f3ebe84e3f.tar
yuzu-5472fd4d9b19011a36604a9c7f9c66f3ebe84e3f.tar.gz
yuzu-5472fd4d9b19011a36604a9c7f9c66f3ebe84e3f.tar.bz2
yuzu-5472fd4d9b19011a36604a9c7f9c66f3ebe84e3f.tar.lz
yuzu-5472fd4d9b19011a36604a9c7f9c66f3ebe84e3f.tar.xz
yuzu-5472fd4d9b19011a36604a9c7f9c66f3ebe84e3f.tar.zst
yuzu-5472fd4d9b19011a36604a9c7f9c66f3ebe84e3f.zip
Diffstat (limited to '')
-rw-r--r--src/core/loader/loader.cpp31
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;
}