Pick up iwads from folders

This commit is contained in:
dpjudas 2025-05-14 02:15:37 +02:00
commit 33b2c792cd

View file

@ -493,6 +493,7 @@ void FIWadManager::CollectSearchPaths()
void FIWadManager::AddIWADCandidates(const char *dir)
{
FileSys::FileList list;
FString iwadinfoName = "iwadinfo";
if (FileSys::ScanDirectory(list, dir, "*", true))
{
@ -517,6 +518,23 @@ void FIWadManager::AddIWADCandidates(const char *dir)
}
}
}
else
{
FileSys::FileList list;
if (FileSys::ScanDirectory(list, entry.FilePath.c_str(), "*", true))
{
for (auto& entry2 : list)
{
std::string s = entry2.FileName;
s.resize(std::min(s.size(), iwadinfoName.Len()));
if (iwadinfoName.CompareNoCase(s.c_str()) == 0)
{
mFoundWads.Push(FFoundWadInfo{ entry.FilePath.c_str(), "", -1 });
break;
}
}
}
}
}
}
}
@ -543,7 +561,12 @@ void FIWadManager::ValidateIWADs()
}
else
{
index = ScanIWAD(p.mFullPath.GetChars());
bool isdir = false;
bool exists = FileSys::FS_DirEntryExists(p.mFullPath.GetChars(), &isdir);
if (exists && isdir)
index = CheckIWADInfo(p.mFullPath.GetChars());
else
index = ScanIWAD(p.mFullPath.GetChars());
}
p.mInfoIndex = index;
}