FileSearch: Namespace functions under the Common namespace
This commit is contained in:
parent
f94cd57a70
commit
f7a2f6ad01
|
@ -9,6 +9,8 @@
|
|||
#include "Common/FileSearch.h"
|
||||
#include "Common/FileUtil.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
static std::vector<std::string>
|
||||
FileSearchWithTest(const std::vector<std::string>& directories, bool recursive,
|
||||
std::function<bool(const File::FSTEntry&)> callback)
|
||||
|
@ -57,3 +59,4 @@ std::vector<std::string> FindSubdirectories(const std::vector<std::string>& dire
|
|||
return FileSearchWithTest(directories, true,
|
||||
[&](const File::FSTEntry& entry) { return entry.isDirectory; });
|
||||
}
|
||||
} // namespace Common
|
||||
|
|
|
@ -7,8 +7,11 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Common
|
||||
{
|
||||
std::vector<std::string> DoFileSearch(const std::vector<std::string>& exts,
|
||||
const std::vector<std::string>& directories,
|
||||
bool recursive = false);
|
||||
std::vector<std::string> FindSubdirectories(const std::vector<std::string>& directories,
|
||||
bool recursive);
|
||||
} // namespace Common
|
||||
|
|
|
@ -145,7 +145,7 @@ GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot, u
|
|||
hdr_file.ReadBytes(&m_hdr, BLOCK_SIZE);
|
||||
}
|
||||
|
||||
std::vector<std::string> filenames = DoFileSearch({".gci"}, {m_save_directory});
|
||||
std::vector<std::string> filenames = Common::DoFileSearch({".gci"}, {m_save_directory});
|
||||
|
||||
if (filenames.size() > 112)
|
||||
{
|
||||
|
|
|
@ -187,9 +187,9 @@ void InterfaceConfigPane::LoadGUIValues()
|
|||
|
||||
void InterfaceConfigPane::LoadThemes()
|
||||
{
|
||||
auto sv =
|
||||
DoFileSearch({""}, {File::GetUserPath(D_THEMES_IDX), File::GetSysDirectory() + THEMES_DIR},
|
||||
/*recursive*/ false);
|
||||
auto sv = Common::DoFileSearch(
|
||||
{""}, {File::GetUserPath(D_THEMES_IDX), File::GetSysDirectory() + THEMES_DIR},
|
||||
/*recursive*/ false);
|
||||
for (const std::string& filename : sv)
|
||||
{
|
||||
std::string name, ext;
|
||||
|
|
|
@ -1593,7 +1593,7 @@ void CFrame::GameListChanged(wxCommandEvent& event)
|
|||
break;
|
||||
case IDM_PURGE_GAME_LIST_CACHE:
|
||||
std::vector<std::string> rFilenames =
|
||||
DoFileSearch({".cache"}, {File::GetUserPath(D_CACHE_IDX)});
|
||||
Common::DoFileSearch({".cache"}, {File::GetUserPath(D_CACHE_IDX)});
|
||||
|
||||
for (const std::string& rFilename : rFilenames)
|
||||
{
|
||||
|
|
|
@ -663,8 +663,9 @@ void CGameListCtrl::ScanForISOs()
|
|||
m_ISOFiles.clear();
|
||||
|
||||
const auto custom_titles = LoadCustomTitles();
|
||||
auto rFilenames = DoFileSearch(GetFileSearchExtensions(), SConfig::GetInstance().m_ISOFolder,
|
||||
SConfig::GetInstance().m_RecursiveISOFolder);
|
||||
auto rFilenames =
|
||||
Common::DoFileSearch(GetFileSearchExtensions(), SConfig::GetInstance().m_ISOFolder,
|
||||
SConfig::GetInstance().m_RecursiveISOFolder);
|
||||
|
||||
if (rFilenames.size() > 0)
|
||||
{
|
||||
|
|
|
@ -264,7 +264,7 @@ void InputConfigDialog::UpdateProfileComboBox()
|
|||
pname += PROFILES_PATH;
|
||||
pname += m_config.GetProfileName();
|
||||
|
||||
std::vector<std::string> sv = DoFileSearch({".ini"}, {pname});
|
||||
std::vector<std::string> sv = Common::DoFileSearch({".ini"}, {pname});
|
||||
|
||||
wxArrayString strs;
|
||||
for (const std::string& filename : sv)
|
||||
|
|
|
@ -82,8 +82,8 @@ std::string VideoBackend::GetDisplayName() const
|
|||
static std::vector<std::string> GetShaders(const std::string& sub_dir = "")
|
||||
{
|
||||
std::vector<std::string> paths =
|
||||
DoFileSearch({".glsl"}, {File::GetUserPath(D_SHADERS_IDX) + sub_dir,
|
||||
File::GetSysDirectory() + SHADERS_DIR DIR_SEP + sub_dir});
|
||||
Common::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)
|
||||
{
|
||||
|
|
|
@ -95,7 +95,7 @@ void HiresTexture::Update()
|
|||
};
|
||||
|
||||
std::vector<std::string> filenames =
|
||||
DoFileSearch(extensions, {texture_directory}, /*recursive*/ true);
|
||||
Common::DoFileSearch(extensions, {texture_directory}, /*recursive*/ true);
|
||||
|
||||
const std::string code = game_id + "_";
|
||||
|
||||
|
|
Loading…
Reference in New Issue