mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-01-30 02:53:20 +00:00
Merge pull request #14230 from Sintendo/file-search
Common/FileSearch: Refactor DoFileSearch
This commit is contained in:
commit
388b1e861c
@ -5,6 +5,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <ios>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
@ -49,9 +50,13 @@ std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array)
|
||||
return result;
|
||||
}
|
||||
|
||||
jobjectArray VectorToJStringArray(JNIEnv* env, const std::vector<std::string>& vector)
|
||||
jobjectArray SpanToJStringArray(JNIEnv* env, std::span<const std::string_view> span)
|
||||
{
|
||||
return VectorToJObjectArray(env, vector, IDCache::GetStringClass(), ToJString);
|
||||
return SpanToJObjectArray(env, span, IDCache::GetStringClass(), ToJString);
|
||||
}
|
||||
jobjectArray SpanToJStringArray(JNIEnv* env, std::span<const std::string> span)
|
||||
{
|
||||
return SpanToJObjectArray(env, span, IDCache::GetStringClass(), ToJString);
|
||||
}
|
||||
|
||||
bool IsPathAndroidContent(std::string_view uri)
|
||||
@ -193,13 +198,13 @@ std::vector<std::string> GetAndroidContentChildNames(std::string_view uri)
|
||||
}
|
||||
|
||||
std::vector<std::string> DoFileSearchAndroidContent(std::string_view directory,
|
||||
const std::vector<std::string>& extensions,
|
||||
std::span<const std::string_view> extensions,
|
||||
bool recursive)
|
||||
{
|
||||
JNIEnv* env = IDCache::GetEnvForThread();
|
||||
|
||||
jstring j_directory = ToJString(env, directory);
|
||||
jobjectArray j_extensions = VectorToJStringArray(env, extensions);
|
||||
jobjectArray j_extensions = SpanToJStringArray(env, extensions);
|
||||
|
||||
jobjectArray j_result = reinterpret_cast<jobjectArray>(env->CallStaticObjectMethod(
|
||||
IDCache::GetContentHandlerClass(), IDCache::GetContentHandlerDoFileSearch(), j_directory,
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <ios>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
@ -14,22 +15,30 @@ std::string GetJString(JNIEnv* env, jstring jstr);
|
||||
jstring ToJString(JNIEnv* env, std::string_view str);
|
||||
|
||||
std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array);
|
||||
jobjectArray VectorToJStringArray(JNIEnv* env, const std::vector<std::string>& vector);
|
||||
jobjectArray SpanToJStringArray(JNIEnv* env, std::span<const std::string_view> span);
|
||||
jobjectArray SpanToJStringArray(JNIEnv* env, std::span<const std::string> span);
|
||||
|
||||
template <typename T, typename F>
|
||||
jobjectArray VectorToJObjectArray(JNIEnv* env, const std::vector<T>& vector, jclass clazz, F f)
|
||||
jobjectArray SpanToJObjectArray(JNIEnv* env, std::span<const T> span, jclass clazz, F f)
|
||||
{
|
||||
const auto vector_size = static_cast<jsize>(vector.size());
|
||||
jobjectArray result = env->NewObjectArray(vector_size, clazz, nullptr);
|
||||
for (jsize i = 0; i < vector_size; ++i)
|
||||
const auto span_size = static_cast<jsize>(span.size());
|
||||
jobjectArray result = env->NewObjectArray(span_size, clazz, nullptr);
|
||||
for (jsize i = 0; i < span_size; ++i)
|
||||
{
|
||||
jobject obj = f(env, vector[i]);
|
||||
jobject obj = f(env, span[i]);
|
||||
env->SetObjectArrayElement(result, i, obj);
|
||||
env->DeleteLocalRef(obj);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T, typename F>
|
||||
inline jobjectArray VectorToJObjectArray(JNIEnv* env, const std::vector<T>& vector, jclass clazz,
|
||||
F f)
|
||||
{
|
||||
return SpanToJObjectArray(env, std::span(vector), clazz, f);
|
||||
}
|
||||
|
||||
// Returns true if the given path should be opened as Android content instead of a normal file.
|
||||
bool IsPathAndroidContent(std::string_view uri);
|
||||
|
||||
@ -55,7 +64,7 @@ std::string GetAndroidContentDisplayName(std::string_view uri);
|
||||
std::vector<std::string> GetAndroidContentChildNames(std::string_view uri);
|
||||
|
||||
std::vector<std::string> DoFileSearchAndroidContent(std::string_view directory,
|
||||
const std::vector<std::string>& extensions,
|
||||
std::span<const std::string_view> extensions,
|
||||
bool recursive);
|
||||
|
||||
int GetNetworkIpAddress();
|
||||
|
||||
@ -15,20 +15,20 @@ JNIEXPORT jobjectArray JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_settings_model_PostProcessing_getShaderList(JNIEnv* env,
|
||||
jclass)
|
||||
{
|
||||
return VectorToJStringArray(env, VideoCommon::PostProcessing::GetShaderList());
|
||||
return SpanToJStringArray(env, VideoCommon::PostProcessing::GetShaderList());
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_settings_model_PostProcessing_getAnaglyphShaderList(
|
||||
JNIEnv* env, jclass)
|
||||
{
|
||||
return VectorToJStringArray(env, VideoCommon::PostProcessing::GetAnaglyphShaderList());
|
||||
return SpanToJStringArray(env, VideoCommon::PostProcessing::GetAnaglyphShaderList());
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_settings_model_PostProcessing_getPassiveShaderList(
|
||||
JNIEnv* env, jclass)
|
||||
{
|
||||
return VectorToJStringArray(env, VideoCommon::PostProcessing::GetPassiveShaderList());
|
||||
return SpanToJStringArray(env, VideoCommon::PostProcessing::GetPassiveShaderList());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// Copyright 2018 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
@ -35,14 +37,16 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_finali
|
||||
JNIEXPORT jobjectArray JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_getAllGamePaths(
|
||||
JNIEnv* env, jclass, jobjectArray folder_paths, jboolean recursive_scan)
|
||||
{
|
||||
return VectorToJStringArray(
|
||||
env, UICommon::FindAllGamePaths(JStringArrayToVector(env, folder_paths), recursive_scan));
|
||||
const std::vector<std::string> paths = JStringArrayToVector(env, folder_paths);
|
||||
std::vector<std::string_view> path_views;
|
||||
std::ranges::copy(paths, std::back_inserter(path_views));
|
||||
return SpanToJStringArray(env, UICommon::FindAllGamePaths(path_views, recursive_scan));
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_model_GameFileCache_getIsoPaths(JNIEnv* env, jclass)
|
||||
{
|
||||
return VectorToJStringArray(env, Config::GetIsoPaths());
|
||||
return SpanToJStringArray(env, Config::GetIsoPaths());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_setIsoPaths(
|
||||
|
||||
@ -5,8 +5,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <system_error>
|
||||
|
||||
#include "Common/CommonPaths.h"
|
||||
@ -21,16 +19,14 @@
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
#include "Common/CommonFuncs.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#endif
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
std::vector<std::string> DoFileSearch(const std::vector<std::string>& directories,
|
||||
const std::vector<std::string>& exts, bool recursive)
|
||||
std::vector<std::string> DoFileSearch(std::span<const std::string_view> directories,
|
||||
std::span<const std::string_view> exts, bool recursive)
|
||||
{
|
||||
const bool accept_all = exts.empty();
|
||||
|
||||
|
||||
@ -3,14 +3,36 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace Common
|
||||
{
|
||||
// Callers can pass empty "exts" to indicate they want all files + directories in results
|
||||
// Otherwise, only files matching the extensions are returned
|
||||
std::vector<std::string> DoFileSearch(const std::vector<std::string>& directories,
|
||||
const std::vector<std::string>& exts = {},
|
||||
std::vector<std::string> DoFileSearch(std::span<const std::string_view> directories,
|
||||
std::span<const std::string_view> exts = {},
|
||||
bool recursive = false);
|
||||
|
||||
inline std::vector<std::string> DoFileSearch(std::span<const std::string_view> directories,
|
||||
std::string_view ext, bool recursive = false)
|
||||
{
|
||||
return DoFileSearch(directories, std::span(&ext, 1), recursive);
|
||||
}
|
||||
|
||||
inline std::vector<std::string> DoFileSearch(std::string_view directory,
|
||||
std::span<const std::string_view> exts = {},
|
||||
bool recursive = false)
|
||||
{
|
||||
return DoFileSearch(std::span(&directory, 1), exts, recursive);
|
||||
}
|
||||
|
||||
inline std::vector<std::string> DoFileSearch(std::string_view directory, std::string_view ext,
|
||||
bool recursive = false)
|
||||
{
|
||||
return DoFileSearch(std::span(&directory, 1), std::span(&ext, 1), recursive);
|
||||
}
|
||||
|
||||
} // namespace Common
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
@ -26,7 +25,6 @@
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Thread.h"
|
||||
#include "Common/Timer.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/SessionSettings.h"
|
||||
@ -134,7 +132,7 @@ std::vector<std::string> GCMemcardDirectory::GetFileNamesForGameID(const std::st
|
||||
game_code = Common::swap32(reinterpret_cast<const u8*>(game_id.c_str()));
|
||||
|
||||
std::vector<Memcard::DEntry> loaded_saves;
|
||||
for (const std::string& file_name : Common::DoFileSearch({directory}, {".gci"}))
|
||||
for (const std::string& file_name : Common::DoFileSearch(directory, ".gci"))
|
||||
{
|
||||
File::IOFile gci_file(file_name, "rb");
|
||||
if (!gci_file)
|
||||
@ -190,7 +188,7 @@ GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, ExpansionIn
|
||||
}
|
||||
|
||||
const bool current_game_only = Config::Get(Config::SESSION_GCI_FOLDER_CURRENT_GAME_ONLY);
|
||||
const std::vector<std::string> filenames = Common::DoFileSearch({m_save_directory}, {".gci"});
|
||||
const std::vector<std::string> filenames = Common::DoFileSearch(m_save_directory, ".gci");
|
||||
|
||||
// split up into files for current games we should definitely load,
|
||||
// and files for other games that we don't care too much about
|
||||
|
||||
@ -399,7 +399,7 @@ std::vector<Patch> GenerateRiivolutionPatchesFromConfig(const std::string& root_
|
||||
const std::optional<Config> config = ParseConfigFile(
|
||||
fmt::format("{}/riivolution/config/{}.xml", root_directory, game_id.substr(0, 4)));
|
||||
|
||||
for (const std::string& path : Common::DoFileSearch({root_directory + "riivolution"}, {".xml"}))
|
||||
for (const std::string& path : Common::DoFileSearch(root_directory + "riivolution", ".xml"))
|
||||
{
|
||||
std::optional<Disc> parsed = ParseFile(path);
|
||||
if (!parsed || !parsed->IsValidForGame(game_id, revision, disc_number))
|
||||
|
||||
@ -534,7 +534,7 @@ void MappingWindow::PopulateProfileSelection()
|
||||
m_profiles_combo->clear();
|
||||
|
||||
const std::string profiles_path = m_config->GetUserProfileDirectoryPath();
|
||||
for (const auto& filename : Common::DoFileSearch({profiles_path}, {".ini"}))
|
||||
for (const auto& filename : Common::DoFileSearch(profiles_path, ".ini"))
|
||||
{
|
||||
std::string basename;
|
||||
SplitPath(filename, nullptr, &basename, nullptr);
|
||||
@ -544,8 +544,7 @@ void MappingWindow::PopulateProfileSelection()
|
||||
|
||||
m_profiles_combo->insertSeparator(m_profiles_combo->count());
|
||||
|
||||
for (const auto& filename :
|
||||
Common::DoFileSearch({m_config->GetSysProfileDirectoryPath()}, {".ini"}))
|
||||
for (const auto& filename : Common::DoFileSearch(m_config->GetSysProfileDirectoryPath(), ".ini"))
|
||||
{
|
||||
std::string basename;
|
||||
SplitPath(filename, nullptr, &basename, nullptr);
|
||||
|
||||
@ -109,7 +109,7 @@ void RiivolutionBootWidget::LoadMatchingXMLs()
|
||||
{
|
||||
const std::string& riivolution_dir = File::GetUserPath(D_RIIVOLUTION_IDX);
|
||||
const auto config = LoadConfigXML(riivolution_dir);
|
||||
for (const std::string& path : Common::DoFileSearch({riivolution_dir + "riivolution"}, {".xml"}))
|
||||
for (const std::string& path : Common::DoFileSearch(riivolution_dir + "riivolution", ".xml"))
|
||||
{
|
||||
auto parsed = DiscIO::Riivolution::ParseFile(path);
|
||||
if (!parsed || !parsed->IsValidForGame(m_game_id, m_revision, m_disc_number))
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/FileSearch.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/AchievementManager.h"
|
||||
@ -34,8 +33,6 @@
|
||||
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
#include "UICommon/GameFile.h"
|
||||
|
||||
static ConfigStringChoice* MakeLanguageComboBox()
|
||||
{
|
||||
using QPair = std::pair<QString, QString>;
|
||||
@ -132,8 +129,8 @@ void InterfacePane::CreateUI()
|
||||
combobox_layout->addRow(tr("&Language:"), m_combobox_language);
|
||||
|
||||
// List available themes
|
||||
auto theme_paths =
|
||||
Common::DoFileSearch({File::GetUserPath(D_THEMES_IDX), File::GetSysDirectory() + THEMES_DIR});
|
||||
auto theme_paths = Common::DoFileSearch(
|
||||
{{File::GetUserPath(D_THEMES_IDX), File::GetSysDirectory() + THEMES_DIR}});
|
||||
std::vector<std::string> theme_names;
|
||||
theme_names.reserve(theme_paths.size());
|
||||
std::ranges::transform(theme_paths, std::back_inserter(theme_names), PathToFileName);
|
||||
@ -147,7 +144,7 @@ void InterfacePane::CreateUI()
|
||||
m_label_userstyle = new QLabel(tr("Style:"));
|
||||
combobox_layout->addRow(m_label_userstyle, m_combobox_userstyle);
|
||||
|
||||
auto userstyle_search_results = Common::DoFileSearch({File::GetUserPath(D_STYLES_IDX)});
|
||||
auto userstyle_search_results = Common::DoFileSearch(File::GetUserPath(D_STYLES_IDX));
|
||||
|
||||
m_combobox_userstyle->addItem(tr("(System)"), static_cast<int>(Settings::StyleType::System));
|
||||
|
||||
|
||||
@ -1173,7 +1173,7 @@ JNIEXPORT jobjectArray JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_features_input_model_ControllerInterface_getAllDeviceStrings(
|
||||
JNIEnv* env, jclass)
|
||||
{
|
||||
return VectorToJStringArray(env, g_controller_interface.GetAllDeviceStrings());
|
||||
return SpanToJStringArray(env, g_controller_interface.GetAllDeviceStrings());
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
|
||||
@ -9,12 +9,10 @@
|
||||
#include "Common/FileSearch.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
||||
#include "InputCommon/DynamicInputTextures/DITConfiguration.h"
|
||||
#include "InputCommon/ImageOperations.h"
|
||||
#include "VideoCommon/HiresTextures.h"
|
||||
#include "VideoCommon/TextureCacheBase.h"
|
||||
|
||||
namespace InputCommon
|
||||
{
|
||||
@ -32,7 +30,7 @@ void DynamicInputTextureManager::Load()
|
||||
|
||||
for (const auto& dynamic_input_directory : dynamic_input_directories)
|
||||
{
|
||||
const auto json_files = Common::DoFileSearch({dynamic_input_directory}, {".json"});
|
||||
const auto json_files = Common::DoFileSearch(dynamic_input_directory, ".json");
|
||||
for (auto& file : json_files)
|
||||
{
|
||||
m_configuration.emplace_back(file);
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/HotkeyManager.h"
|
||||
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
@ -37,7 +37,7 @@ std::vector<std::string> GetProfilesFromSetting(const std::string& setting, cons
|
||||
const std::string path = root + std::string(StripWhitespace(setting_choice));
|
||||
if (File::IsDirectory(path))
|
||||
{
|
||||
const auto files_under_directory = Common::DoFileSearch({path}, {".ini"}, true);
|
||||
const auto files_under_directory = Common::DoFileSearch(path, ".ini", true);
|
||||
result.insert(result.end(), files_under_directory.begin(), files_under_directory.end());
|
||||
}
|
||||
else
|
||||
@ -57,7 +57,7 @@ std::vector<std::string> ProfileCycler::GetProfilesForDevice(InputConfig* device
|
||||
{
|
||||
const std::string device_profile_root_location(
|
||||
device_configuration->GetUserProfileDirectoryPath());
|
||||
return Common::DoFileSearch({device_profile_root_location}, {".ini"}, true);
|
||||
return Common::DoFileSearch(device_profile_root_location, ".ini", true);
|
||||
}
|
||||
|
||||
std::string ProfileCycler::GetProfile(CycleDirection cycle_direction, int& profile_index,
|
||||
|
||||
@ -5,10 +5,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
@ -28,12 +25,12 @@ namespace UICommon
|
||||
{
|
||||
static constexpr u32 CACHE_REVISION = 26; // Last changed in PR 10084
|
||||
|
||||
std::vector<std::string> FindAllGamePaths(const std::vector<std::string>& directories_to_scan,
|
||||
std::vector<std::string> FindAllGamePaths(std::span<const std::string_view> directories_to_scan,
|
||||
bool recursive_scan)
|
||||
{
|
||||
static const std::vector<std::string> search_extensions = {
|
||||
".gcm", ".tgc", ".bin", ".iso", ".ciso", ".gcz", ".wbfs",
|
||||
".wia", ".rvz", ".nfs", ".wad", ".dol", ".elf", ".json"};
|
||||
constexpr auto search_extensions =
|
||||
std::to_array<std::string_view>({".gcm", ".tgc", ".bin", ".iso", ".ciso", ".gcz", ".wbfs",
|
||||
".wia", ".rvz", ".nfs", ".wad", ".dol", ".elf", ".json"});
|
||||
|
||||
// TODO: We could process paths iteratively as they are found
|
||||
return Common::DoFileSearch(directories_to_scan, search_extensions, recursive_scan);
|
||||
|
||||
@ -19,7 +19,7 @@ namespace UICommon
|
||||
{
|
||||
class GameFile;
|
||||
|
||||
std::vector<std::string> FindAllGamePaths(const std::vector<std::string>& directories_to_scan,
|
||||
std::vector<std::string> FindAllGamePaths(std::span<const std::string_view> directories_to_scan,
|
||||
bool recursive_scan);
|
||||
|
||||
class GameFileCache
|
||||
|
||||
@ -32,7 +32,7 @@ bool Init()
|
||||
{
|
||||
packs.clear();
|
||||
const std::vector<std::string> pack_list =
|
||||
Common::DoFileSearch({File::GetUserPath(D_RESOURCEPACK_IDX)}, {".zip"});
|
||||
Common::DoFileSearch(File::GetUserPath(D_RESOURCEPACK_IDX), ".zip");
|
||||
|
||||
Common::IniFile file = GetPackConfig();
|
||||
|
||||
|
||||
@ -305,7 +305,7 @@ bool ResourcePack::Uninstall(const std::string& path)
|
||||
|
||||
while (dir.length() > (path + TEXTURE_PATH).length())
|
||||
{
|
||||
auto is_empty = Common::DoFileSearch({dir}).empty();
|
||||
const auto is_empty = Common::DoFileSearch(dir).empty();
|
||||
|
||||
if (is_empty)
|
||||
File::DeleteDir(dir);
|
||||
|
||||
@ -3,15 +3,11 @@
|
||||
|
||||
#include "VideoCommon/HiresTextures.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <xxhash.h>
|
||||
|
||||
#include <fmt/format.h>
|
||||
@ -21,10 +17,8 @@
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/System.h"
|
||||
#include "VideoCommon/Assets/CustomAsset.h"
|
||||
#include "VideoCommon/Assets/DirectFilesystemAssetLibrary.h"
|
||||
#include "VideoCommon/OnScreenDisplay.h"
|
||||
#include "VideoCommon/Resources/CustomResourceManager.h"
|
||||
@ -93,7 +87,7 @@ void HiresTexture::Update()
|
||||
const std::string& game_id = SConfig::GetInstance().GetGameID();
|
||||
const std::set<std::string> texture_directories =
|
||||
GetTextureDirectoriesWithGameId(File::GetUserPath(D_HIRESTEXTURES_IDX), game_id);
|
||||
const std::vector<std::string> extensions{".png", ".dds"};
|
||||
constexpr auto extensions = std::to_array<std::string_view>({".png", ".dds"});
|
||||
|
||||
for (const auto& texture_directory : texture_directories)
|
||||
{
|
||||
@ -101,7 +95,7 @@ void HiresTexture::Update()
|
||||
s_file_library->Watch(texture_directory);
|
||||
|
||||
const auto texture_paths =
|
||||
Common::DoFileSearch({texture_directory}, extensions, /*recursive*/ true);
|
||||
Common::DoFileSearch(texture_directory, extensions, /*recursive*/ true);
|
||||
|
||||
bool failed_insert = false;
|
||||
for (auto& path : texture_paths)
|
||||
@ -227,7 +221,7 @@ std::set<std::string> GetTextureDirectoriesWithGameId(const std::string& root_di
|
||||
};
|
||||
|
||||
// Look for any other directories that might be specific to the given gameid
|
||||
const auto files = Common::DoFileSearch({root_directory}, {".txt"}, true);
|
||||
const auto files = Common::DoFileSearch(root_directory, ".txt", true);
|
||||
for (const auto& file : files)
|
||||
{
|
||||
if (match_gameid_or_all(file))
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
#include "VideoCommon/AbstractPipeline.h"
|
||||
#include "VideoCommon/AbstractShader.h"
|
||||
#include "VideoCommon/AbstractTexture.h"
|
||||
#include "VideoCommon/FramebufferManager.h"
|
||||
#include "VideoCommon/Present.h"
|
||||
#include "VideoCommon/ShaderCache.h"
|
||||
#include "VideoCommon/ShaderCompileUtils.h"
|
||||
@ -387,9 +386,9 @@ PostProcessing::~PostProcessing()
|
||||
static std::vector<std::string> GetShaders(const std::string& sub_dir = "")
|
||||
{
|
||||
std::vector<std::string> paths =
|
||||
Common::DoFileSearch({File::GetUserPath(D_SHADERS_IDX) + sub_dir,
|
||||
File::GetSysDirectory() + SHADERS_DIR DIR_SEP + sub_dir},
|
||||
{".glsl"});
|
||||
Common::DoFileSearch({{File::GetUserPath(D_SHADERS_IDX) + sub_dir,
|
||||
File::GetSysDirectory() + SHADERS_DIR DIR_SEP + sub_dir}},
|
||||
".glsl");
|
||||
std::vector<std::string> result;
|
||||
for (std::string path : paths)
|
||||
{
|
||||
|
||||
@ -58,7 +58,7 @@ void TextureDumper::DumpTexture(const ::AbstractTexture& texture, std::string ba
|
||||
if (!File::IsDirectory(dump_dir))
|
||||
File::CreateDir(dump_dir);
|
||||
|
||||
for (auto& filename : Common::DoFileSearch({dump_dir}, {".png"}, true))
|
||||
for (auto& filename : Common::DoFileSearch(dump_dir, ".png", true))
|
||||
{
|
||||
std::string name;
|
||||
SplitPath(filename, nullptr, &name, nullptr);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user