diff options
| author | shuffle2 <godisgovernment@gmail.com> | 2017-06-26 11:44:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-26 11:44:44 -0700 |
| commit | 02690d5d7c6bc36d230ee9c959a830918b5bec37 (patch) | |
| tree | d67c2cf560e3040caa54bb4e99c8ba5743d997ea /Source/Core/Common/FileSearch.cpp | |
| parent | 99b173542417811020b5d639449b496ceadae42a (diff) | |
| parent | 1fc5eae5bd99e9a17e634f48e8291e6eed4202cc (diff) | |
Merge pull request #5693 from JosJuice/filesearch-minor-changes
FileSearch: Minor changes
Diffstat (limited to 'Source/Core/Common/FileSearch.cpp')
| -rw-r--r-- | Source/Core/Common/FileSearch.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/Source/Core/Common/FileSearch.cpp b/Source/Core/Common/FileSearch.cpp index 3f810132f5..4b3b0820d2 100644 --- a/Source/Core/Common/FileSearch.cpp +++ b/Source/Core/Common/FileSearch.cpp @@ -46,14 +46,15 @@ FileSearchWithTest(const std::vector<std::string>& directories, bool recursive, return result; } -static std::vector<std::string> DoFileSearchNoSTL(const std::vector<std::string>& directories, - const std::vector<std::string>& exts, - bool recursive) +std::vector<std::string> DoFileSearch(const std::vector<std::string>& directories, + const std::vector<std::string>& exts, bool recursive) { bool accept_all = exts.empty(); return FileSearchWithTest(directories, recursive, [&](const File::FSTEntry& entry) { if (accept_all) 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) { @@ -63,12 +64,6 @@ static std::vector<std::string> DoFileSearchNoSTL(const std::vector<std::string> }); } -std::vector<std::string> DoFileSearch(const std::vector<std::string>& directories, - const std::vector<std::string>& exts, bool recursive) -{ - return DoFileSearchNoSTL(directories, exts, recursive); -} - #else std::vector<std::string> DoFileSearch(const std::vector<std::string>& directories, @@ -120,9 +115,11 @@ std::vector<std::string> DoFileSearch(const std::vector<std::string>& directorie std::sort(result.begin(), result.end()); result.erase(std::unique(result.begin(), result.end()), result.end()); - // Dolphin expects to be able to use "/" (DIR_SEP) everywhere. std::filesystem uses the OS - // separator. - if (fs::path::preferred_separator != DIR_SEP_CHR) + // Dolphin expects to be able to use "/" (DIR_SEP) everywhere. + // std::filesystem uses the OS separator. + constexpr fs::path::value_type os_separator = fs::path::preferred_separator; + static_assert(os_separator == DIR_SEP_CHR || os_separator == '\\', "Unsupported path separator"); + if (os_separator != DIR_SEP_CHR) for (auto& path : result) std::replace(path.begin(), path.end(), '\\', DIR_SEP_CHR); |
