diff --git a/Core/Loaders.cpp b/Core/Loaders.cpp index ef035cf057..cfb997dd52 100644 --- a/Core/Loaders.cpp +++ b/Core/Loaders.cpp @@ -76,11 +76,6 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader, std::string *errorStrin return IdentifiedFileType::ERROR_IDENTIFYING; } - if (!fileLoader->Exists()) { - *errorString = "IdentifyFile: File doesn't exist: " + fileLoader->GetPath().ToString(); - return IdentifiedFileType::ERROR_IDENTIFYING; - } - std::string extension = fileLoader->GetFileExtension(); // First, check if it's a directory with an EBOOT.PBP in it. @@ -106,6 +101,11 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader, std::string *errorStrin return IdentifiedFileType::NORMAL_DIRECTORY; } + if (!fileLoader->Exists()) { + *errorString = "IdentifyFile: File doesn't exist: " + fileLoader->GetPath().ToString(); + return IdentifiedFileType::ERROR_IDENTIFYING; + } + bool isDiscImage = false; if (extension == ".iso" || extension == ".cso" || extension == ".chd") { isDiscImage = true; diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 60890415f4..2b7d22dfcf 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -558,7 +558,7 @@ public: void Run() override { // An early-return will result in the destructor running, where we can set // flags like working and pending. - if (!info_->CreateLoader() || !info_->GetFileLoader() || !info_->GetFileLoader()->Exists()) { + if (!info_->CreateLoader() || !info_->GetFileLoader()) { // Mark everything requested as done, so std::unique_lock lock(info_->lock); info_->MarkReadyNoLock(flags_); @@ -584,6 +584,13 @@ public: } } + if (!pbpLoader->Exists()) { + ERROR_LOG(Log::Loader, "File doesn't exist: %s\n", pbpLoader->GetPath().c_str()); + std::unique_lock lock(info_->lock); + info_->MarkReadyNoLock(flags_); + return; + } + PBPReader pbp(pbpLoader.get()); if (!pbp.IsValid()) { if (pbp.IsELF()) {