mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 07:21:14 +01:00
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/FileSearch.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
|
|
||||||
|
namespace Common
|
||||||
|
{
|
||||||
static std::vector<std::string>
|
static std::vector<std::string>
|
||||||
FileSearchWithTest(const std::vector<std::string>& directories, bool recursive,
|
FileSearchWithTest(const std::vector<std::string>& directories, bool recursive,
|
||||||
std::function<bool(const File::FSTEntry&)> callback)
|
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,
|
return FileSearchWithTest(directories, true,
|
||||||
[&](const File::FSTEntry& entry) { return entry.isDirectory; });
|
[&](const File::FSTEntry& entry) { return entry.isDirectory; });
|
||||||
}
|
}
|
||||||
|
} // namespace Common
|
||||||
|
@ -7,8 +7,11 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Common
|
||||||
|
{
|
||||||
std::vector<std::string> DoFileSearch(const std::vector<std::string>& exts,
|
std::vector<std::string> DoFileSearch(const std::vector<std::string>& exts,
|
||||||
const std::vector<std::string>& directories,
|
const std::vector<std::string>& directories,
|
||||||
bool recursive = false);
|
bool recursive = false);
|
||||||
std::vector<std::string> FindSubdirectories(const std::vector<std::string>& directories,
|
std::vector<std::string> FindSubdirectories(const std::vector<std::string>& directories,
|
||||||
bool recursive);
|
bool recursive);
|
||||||
|
} // namespace Common
|
||||||
|
@ -145,7 +145,7 @@ GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot, u
|
|||||||
hdr_file.ReadBytes(&m_hdr, BLOCK_SIZE);
|
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)
|
if (filenames.size() > 112)
|
||||||
{
|
{
|
||||||
|
@ -187,9 +187,9 @@ void InterfaceConfigPane::LoadGUIValues()
|
|||||||
|
|
||||||
void InterfaceConfigPane::LoadThemes()
|
void InterfaceConfigPane::LoadThemes()
|
||||||
{
|
{
|
||||||
auto sv =
|
auto sv = Common::DoFileSearch(
|
||||||
DoFileSearch({""}, {File::GetUserPath(D_THEMES_IDX), File::GetSysDirectory() + THEMES_DIR},
|
{""}, {File::GetUserPath(D_THEMES_IDX), File::GetSysDirectory() + THEMES_DIR},
|
||||||
/*recursive*/ false);
|
/*recursive*/ false);
|
||||||
for (const std::string& filename : sv)
|
for (const std::string& filename : sv)
|
||||||
{
|
{
|
||||||
std::string name, ext;
|
std::string name, ext;
|
||||||
|
@ -1593,7 +1593,7 @@ void CFrame::GameListChanged(wxCommandEvent& event)
|
|||||||
break;
|
break;
|
||||||
case IDM_PURGE_GAME_LIST_CACHE:
|
case IDM_PURGE_GAME_LIST_CACHE:
|
||||||
std::vector<std::string> rFilenames =
|
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)
|
for (const std::string& rFilename : rFilenames)
|
||||||
{
|
{
|
||||||
|
@ -663,8 +663,9 @@ void CGameListCtrl::ScanForISOs()
|
|||||||
m_ISOFiles.clear();
|
m_ISOFiles.clear();
|
||||||
|
|
||||||
const auto custom_titles = LoadCustomTitles();
|
const auto custom_titles = LoadCustomTitles();
|
||||||
auto rFilenames = DoFileSearch(GetFileSearchExtensions(), SConfig::GetInstance().m_ISOFolder,
|
auto rFilenames =
|
||||||
SConfig::GetInstance().m_RecursiveISOFolder);
|
Common::DoFileSearch(GetFileSearchExtensions(), SConfig::GetInstance().m_ISOFolder,
|
||||||
|
SConfig::GetInstance().m_RecursiveISOFolder);
|
||||||
|
|
||||||
if (rFilenames.size() > 0)
|
if (rFilenames.size() > 0)
|
||||||
{
|
{
|
||||||
|
@ -264,7 +264,7 @@ void InputConfigDialog::UpdateProfileComboBox()
|
|||||||
pname += PROFILES_PATH;
|
pname += PROFILES_PATH;
|
||||||
pname += m_config.GetProfileName();
|
pname += m_config.GetProfileName();
|
||||||
|
|
||||||
std::vector<std::string> sv = DoFileSearch({".ini"}, {pname});
|
std::vector<std::string> sv = Common::DoFileSearch({".ini"}, {pname});
|
||||||
|
|
||||||
wxArrayString strs;
|
wxArrayString strs;
|
||||||
for (const std::string& filename : sv)
|
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 = "")
|
static std::vector<std::string> GetShaders(const std::string& sub_dir = "")
|
||||||
{
|
{
|
||||||
std::vector<std::string> paths =
|
std::vector<std::string> paths =
|
||||||
DoFileSearch({".glsl"}, {File::GetUserPath(D_SHADERS_IDX) + sub_dir,
|
Common::DoFileSearch({".glsl"}, {File::GetUserPath(D_SHADERS_IDX) + sub_dir,
|
||||||
File::GetSysDirectory() + SHADERS_DIR DIR_SEP + sub_dir});
|
File::GetSysDirectory() + SHADERS_DIR DIR_SEP + sub_dir});
|
||||||
std::vector<std::string> result;
|
std::vector<std::string> result;
|
||||||
for (std::string path : paths)
|
for (std::string path : paths)
|
||||||
{
|
{
|
||||||
|
@ -95,7 +95,7 @@ void HiresTexture::Update()
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::vector<std::string> filenames =
|
std::vector<std::string> filenames =
|
||||||
DoFileSearch(extensions, {texture_directory}, /*recursive*/ true);
|
Common::DoFileSearch(extensions, {texture_directory}, /*recursive*/ true);
|
||||||
|
|
||||||
const std::string code = game_id + "_";
|
const std::string code = game_id + "_";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user