Avoid duplicate paths for zip install

This commit is contained in:
Henrik Rydgård committed 2026-03-08 10:46:30 +01:00
1 parent a2de96a4d1
commit 96deade782
1 file changed
+16 -2
+16 -2
View File
@@ -117,6 +117,16 @@ void InstallZipScreen::CreateSettingsViews(UI::ViewGroup *parent) {
}
}
template<class T>
bool Contains(const std::vector<T> &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));
}