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)); }