From 96deade782b253f0a733dbcafad2ce57f9100e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 8 Mar 2026 10:46:30 +0100 Subject: [PATCH] Avoid duplicate paths for zip install --- UI/InstallZipScreen.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/UI/InstallZipScreen.cpp b/UI/InstallZipScreen.cpp index 1e519ed6af..688c5e9081 100644 --- a/UI/InstallZipScreen.cpp +++ b/UI/InstallZipScreen.cpp @@ -117,6 +117,16 @@ void InstallZipScreen::CreateSettingsViews(UI::ViewGroup *parent) { } } +template +bool Contains(const std::vector &vec, const T &needle) { + for (const auto &item : vec) { + if (item == needle) { + return true; + } + } + return false; +} + void InstallZipScreen::CreateContentViews(UI::ViewGroup *parent) { using namespace UI; @@ -161,9 +171,13 @@ void InstallZipScreen::CreateContentViews(UI::ViewGroup *parent) { destFolders_.push_back(parent); } if (g_Config.currentDirectory.IsLocalType() && File::Exists(g_Config.currentDirectory) && g_Config.currentDirectory != parent) { - destFolders_.push_back(g_Config.currentDirectory); + if (!Contains(destFolders_, g_Config.currentDirectory)) { + destFolders_.push_back(g_Config.currentDirectory); + } + } + if (!Contains(destFolders_, g_Config.memStickDirectory)) { + destFolders_.push_back(g_Config.memStickDirectory); } - destFolders_.push_back(g_Config.memStickDirectory); } else { destFolders_.push_back(GetSysDirectory(DIRECTORY_GAME)); }