void CGameUtils::GetGameClients(const CFileItem& file, GameClientVector& candidates, GameClientVector& installable, bool& bHasVfsGameClient) { using namespace ADDON; bHasVfsGameClient = false; // Try to resolve path to a local file, as not all game clients support VFS CURL translatedUrl(CSpecialProtocol::TranslatePath(file.GetPath())); // Get local candidates VECADDONS localAddons; CBinaryAddonCache& addonCache = CServiceBroker::GetBinaryAddonCache(); addonCache.GetAddons(localAddons, ADDON_GAMEDLL); bool bVfs = false; GetGameClients(localAddons, translatedUrl, candidates, bVfs); bHasVfsGameClient |= bVfs; // Get remote candidates VECADDONS remoteAddons; if (CServiceBroker::GetAddonMgr().GetInstallableAddons(remoteAddons, ADDON_GAMEDLL)) { GetGameClients(remoteAddons, translatedUrl, installable, bVfs); bHasVfsGameClient |= bVfs; } // Sort by name //! @todo Move to presentation code auto SortByName = [](const GameClientPtr& lhs, const GameClientPtr& rhs) { std::string lhsName = lhs->Name(); std::string rhsName = rhs->Name(); StringUtils::ToLower(lhsName); StringUtils::ToLower(rhsName); return lhsName < rhsName; }; std::sort(candidates.begin(), candidates.end(), SortByName); std::sort(installable.begin(), installable.end(), SortByName); }