Override global config values in Downloader::checkOrphans

Previously orphan checking was limited to user selected language and platform values.
This meant that by default only English language and Windows+Linux was selected.
Overriding the global config values and clearing previously got details before starting the orphan check makes --check-orphans work as intended.
This commit is contained in:
Sude 2020-02-17 19:24:04 +02:00
parent 8f69f44bb1
commit 56a06133d2

View File

@ -1743,11 +1743,25 @@ static int isPresent(std::vector<gameFile>& list, const boost::filesystem::path&
void Downloader::checkOrphans()
{
// Always check everything when checking for orphaned files
Globals::globalConfig.dlConf.bInstallers = true;
Globals::globalConfig.dlConf.bExtras = true;
Globals::globalConfig.dlConf.bPatches = true;
Globals::globalConfig.dlConf.bLanguagePacks = true;
Globals::globalConfig.dlConf.bDLC = true;
Globals::globalConfig.dlConf.iInstallerLanguage = Util::getOptionValue("all", GlobalConstants::LANGUAGES);
Globals::globalConfig.dlConf.iInstallerPlatform = Util::getOptionValue("all", GlobalConstants::PLATFORMS);
Globals::globalConfig.dlConf.vLanguagePriority.clear();
Globals::globalConfig.dlConf.vPlatformPriority.clear();
Config config = Globals::globalConfig;
config.dlConf.bInstallers = true;
config.dlConf.bExtras = true;
config.dlConf.bPatches = true;
config.dlConf.bLanguagePacks = true;
// Checking orphans after download.
// Game details have already been retrieved but possibly filtered.
// Therefore we need to clear game details and get them again.
if (config.bDownload)
{
this->gameItems.clear();
this->games.clear();
}
if (this->games.empty())
this->getGameDetails();