From 4fa529db50a0a70133bd0e7bd9f8b9b5deb673a0 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Tue, 9 Jun 2015 23:19:09 -0700 Subject: [PATCH] Potentially reuse a cached file loader. Although right now we always dispose, this just makes it so we could more easily garbage collect them if we wanted. --- UI/GameInfoCache.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 0823a2c8a4..4050b9c0f5 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -166,11 +166,14 @@ u64 GameInfo::GetInstallDataSizeInBytes() { } bool GameInfo::LoadFromPath(const std::string &gamePath) { - delete fileLoader; - fileLoader = ConstructFileLoader(gamePath); - filePath_ = gamePath; + // No need to rebuild if we already have it loaded. + if (filePath_ != gamePath) { + delete fileLoader; + fileLoader = ConstructFileLoader(gamePath); + filePath_ = gamePath; + } - return fileLoader->Exists(); + return GetFileLoader()->Exists(); } FileLoader *GameInfo::GetFileLoader() {