summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/ISOFile.cpp
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2015-11-27 23:10:45 +1300
committerScott Mansell <phiren@gmail.com>2015-11-27 23:10:45 +1300
commitdf4c1d680e5ca366f6d1656a03c2392927b8a158 (patch)
tree61f1371663dbf2fb5fdf1ac1edb73d2fff2fb02c /Source/Core/DolphinWX/ISOFile.cpp
parentf33a9ed439ee133f88ca12b6954177bddc8ecc04 (diff)
parent4249d9ef773a027d13630044522579af582dbdba (diff)
Merge pull request #3264 from JosJuice/simplify-iselfordol
ISOFile/GameFile: Simplify IsElfOrDol
Diffstat (limited to 'Source/Core/DolphinWX/ISOFile.cpp')
-rw-r--r--Source/Core/DolphinWX/ISOFile.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/Source/Core/DolphinWX/ISOFile.cpp b/Source/Core/DolphinWX/ISOFile.cpp
index 58d7b71ad7..3858cbca61 100644
--- a/Source/Core/DolphinWX/ISOFile.cpp
+++ b/Source/Core/DolphinWX/ISOFile.cpp
@@ -216,15 +216,12 @@ void GameListItem::DoState(PointerWrap &p)
bool GameListItem::IsElfOrDol() const
{
- const size_t pos = m_FileName.rfind('.');
- if (pos != std::string::npos)
- {
- std::string ext = m_FileName.substr(pos);
- std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
+ if (m_FileName.size() < 4)
+ return false;
- return ext == ".elf" || ext == ".dol";
- }
- return false;
+ std::string name_end = m_FileName.substr(m_FileName.size() - 4);
+ std::transform(name_end.begin(), name_end.end(), name_end.begin(), ::tolower);
+ return name_end == ".elf" || name_end == ".dol";
}
std::string GameListItem::CreateCacheFilename() const