summaryrefslogtreecommitdiff
path: root/Source/Core/Common/FileSearch.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-06-27 12:45:02 +0200
committerJosJuice <josjuice@gmail.com>2017-06-27 21:32:07 +0200
commita6471234a22e15176424d24cb31be56fd8e73061 (patch)
treeddb5d778d3f5fcab6c7100b3f25e4d27a7b97a60 /Source/Core/Common/FileSearch.cpp
parentcaf60877663df273cf858d6f913ba5aaf24414be (diff)
FileSearch: Use strcasecmp in non-std code
Because why should only Windows get in on the FileSearch speedup fun? (Not that this fixes the slowness of File::ScanDirectoryTree...)
Diffstat (limited to 'Source/Core/Common/FileSearch.cpp')
-rw-r--r--Source/Core/Common/FileSearch.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/Core/Common/FileSearch.cpp b/Source/Core/Common/FileSearch.cpp
index 4b3b0820d2..cca5c095f7 100644
--- a/Source/Core/Common/FileSearch.cpp
+++ b/Source/Core/Common/FileSearch.cpp
@@ -14,6 +14,8 @@
namespace fs = std::experimental::filesystem;
#define HAS_STD_FILESYSTEM
#else
+#include <cstring>
+#include "Common/CommonFuncs.h"
#include "Common/FileUtil.h"
#endif
@@ -55,11 +57,10 @@ std::vector<std::string> DoFileSearch(const std::vector<std::string>& directorie
return true;
if (entry.isDirectory)
return false;
- std::string name = entry.virtualName;
- std::transform(name.begin(), name.end(), name.begin(), ::tolower);
return std::any_of(exts.begin(), exts.end(), [&](const std::string& ext) {
+ const std::string& name = entry.virtualName;
return name.length() >= ext.length() &&
- name.compare(name.length() - ext.length(), ext.length(), ext) == 0;
+ strcasecmp(name.c_str() + name.length() - ext.length(), ext.c_str()) == 0;
});
});
}