From 6b3e871de449fa26bb46799f753fae24645571d2 Mon Sep 17 00:00:00 2001 From: oltolm Date: Wed, 18 Jun 2025 22:09:51 +0200 Subject: [PATCH] UI: replace std::list with std::vector --- src/gui/wxgui/components/wxGameList.cpp | 20 ++++++++++---------- src/gui/wxgui/components/wxGameList.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gui/wxgui/components/wxGameList.cpp b/src/gui/wxgui/components/wxGameList.cpp index f760e0b3..d6933d9b 100644 --- a/src/gui/wxgui/components/wxGameList.cpp +++ b/src/gui/wxgui/components/wxGameList.cpp @@ -66,21 +66,21 @@ void _stripPathFilename(fs::path& path) path = path.parent_path(); } -std::list _getCachesPaths(const TitleId& titleId) +std::vector _getCachesPaths(const TitleId& titleId) { - std::list cachePaths{ + std::vector cachePaths{ ActiveSettings::GetCachePath(L"shaderCache/driver/vk/{:016x}.bin", titleId), ActiveSettings::GetCachePath(L"shaderCache/precompiled/{:016x}_spirv.bin", titleId), ActiveSettings::GetCachePath(L"shaderCache/precompiled/{:016x}_gl.bin", titleId), ActiveSettings::GetCachePath(L"shaderCache/transferable/{:016x}_shaders.bin", titleId), ActiveSettings::GetCachePath(L"shaderCache/transferable/{:016x}_vkpipeline.bin", titleId)}; - cachePaths.remove_if( - [](const fs::path& cachePath) - { - std::error_code ec; - return !fs::exists(cachePath, ec); - }); + cachePaths.erase(std::remove_if(cachePaths.begin(), cachePaths.end(), + [](const fs::path& cachePath) { + std::error_code ec; + return !fs::exists(cachePath, ec); + }), + cachePaths.end()); return cachePaths; } @@ -1280,7 +1280,7 @@ void wxGameList::HandleTitleListCallback(CafeTitleListCallbackEvent* evt) } } -void wxGameList::RemoveCache(const std::list& cachePaths, const std::string& titleName) +void wxGameList::RemoveCache(const std::vector& cachePaths, const std::string& titleName) { wxMessageDialog dialog(this, formatWxString(_("Remove the shader caches for {}?"), titleName), _("Remove shader caches"), wxCENTRE | wxYES_NO | wxICON_EXCLAMATION); dialog.SetYesNoLabels(_("Yes"), _("No")); @@ -1288,7 +1288,7 @@ void wxGameList::RemoveCache(const std::list& cachePaths, const std::s const auto dialogResult = dialog.ShowModal(); if (dialogResult != wxID_YES) return; - std::list errs; + std::vector errs; for (const fs::path& cachePath : cachePaths) { if (std::error_code ec; !fs::remove(cachePath, ec)) diff --git a/src/gui/wxgui/components/wxGameList.h b/src/gui/wxgui/components/wxGameList.h index e4f90ca3..be6e0492 100644 --- a/src/gui/wxgui/components/wxGameList.h +++ b/src/gui/wxgui/components/wxGameList.h @@ -114,7 +114,7 @@ private: void HandleTitleListCallback(struct CafeTitleListCallbackEvent* evt); - void RemoveCache(const std::list& cachePath, const std::string& titleName); + void RemoveCache(const std::vector& cachePath, const std::string& titleName); void AsyncWorkerThread(); void RequestLoadIconAsync(TitleId titleId);