Merge pull request #3075 from waddlesplash/no-regexp

FileSearch: Don't use RegExes, just do string comparisons.
This commit is contained in:
Scott Mansell
2015-10-02 04:00:23 +13:00
10 changed files with 41 additions and 46 deletions

View File

@ -38,7 +38,6 @@ Make AA apply instantly during gameplay if possible
#include <algorithm>
#include <cstdarg>
#include <regex>
#include "Common/Atomic.h"
#include "Common/CommonPaths.h"
@ -105,13 +104,17 @@ std::string VideoBackend::GetDisplayName() const
static std::vector<std::string> GetShaders(const std::string &sub_dir = "")
{
std::vector<std::string> paths = DoFileSearch({"*.glsl"}, {
std::vector<std::string> paths = DoFileSearch({".glsl"}, {
File::GetUserPath(D_SHADERS_IDX) + sub_dir,
File::GetSysDirectory() + SHADERS_DIR DIR_SEP + sub_dir
});
std::vector<std::string> result;
for (std::string path : paths)
result.push_back(std::regex_replace(path, std::regex("^.*/(.*)\\.glsl$"), "$1"));
{
std::string name;
SplitPath(path, nullptr, &name, nullptr);
result.push_back(name);
}
return result;
}