Allows loading directories as IWADs using "-iwad" command line parameter.

This commit is contained in:
MaxED 2016-10-24 14:13:40 +03:00 committed by Christoph Oelckers
parent 623910bd2a
commit 81449728d7

View file

@ -292,6 +292,7 @@ void FIWadManager::ParseIWadInfos(const char *fn)
int FIWadManager::ScanIWAD (const char *iwad) int FIWadManager::ScanIWAD (const char *iwad)
{ {
FResourceFile *iwadfile = FResourceFile::OpenResourceFile(iwad, NULL, true); FResourceFile *iwadfile = FResourceFile::OpenResourceFile(iwad, NULL, true);
if (iwadfile == NULL) iwadfile = FResourceFile::OpenDirectory(iwad, true); //mxd. A directory can also work as an IWAD
if (iwadfile != NULL) if (iwadfile != NULL)
{ {
@ -344,7 +345,7 @@ int FIWadManager::CheckIWAD (const char *doomwaddir, WadStuff *wads)
iwad.Format ("%s%s%s", doomwaddir, slash, mIWadNames[i].GetChars()); iwad.Format ("%s%s%s", doomwaddir, slash, mIWadNames[i].GetChars());
FixPathSeperator (iwad); FixPathSeperator (iwad);
if (FileExists (iwad)) if (DirEntryExists(iwad))
{ {
wads[i].Type = ScanIWAD (iwad); wads[i].Type = ScanIWAD (iwad);
if (wads[i].Type != -1) if (wads[i].Type != -1)
@ -413,7 +414,7 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
} }
else else
{ {
DefaultExtension (custwad, ".wad"); if(FileExists(custwad)) DefaultExtension (custwad, ".wad"); //mxd. Don't treat folders as .wads
iwadparm = custwad; iwadparm = custwad;
mIWadNames[0] = custwad; mIWadNames[0] = custwad;
CheckIWAD ("", &wads[0]); CheckIWAD ("", &wads[0]);