- fixed: The newly altered WAD code could not load embedded WADs anymore.

SVN r1785 (trunk)
This commit is contained in:
Christoph Oelckers 2009-09-02 20:29:52 +00:00
parent c24c31cc9f
commit 1d582a7550
2 changed files with 27 additions and 21 deletions

View file

@ -1,4 +1,7 @@
September 1, 2009 September 2, 2009 (Changes by Graf Zahl)
- fixed: The newly altered WAD code could not load embedded WADs anymore.
September 1, 2009
- Added directory detection to the -file parameter. This obsoletes -dir, so - Added directory detection to the -file parameter. This obsoletes -dir, so
that parameter is now gone. that parameter is now gone.
- Removed automatic ".wad" appending from FWadCollection::InitMultipleFiles() - Removed automatic ".wad" appending from FWadCollection::InitMultipleFiles()

View file

@ -225,30 +225,33 @@ int FWadCollection::AddExternalFile(const char *filename)
void FWadCollection::AddFile (const char *filename, FileReader *wadinfo) void FWadCollection::AddFile (const char *filename, FileReader *wadinfo)
{ {
int startlump; int startlump;
bool isdir; bool isdir = false;
// Does this exist? If so, is it a directory? if (wadinfo == NULL)
struct stat info;
if (stat(filename, &info) != 0)
{ {
Printf(TEXTCOLOR_RED "Could not stat %s\n", filename); // Does this exist? If so, is it a directory?
PrintLastError(); struct stat info;
return; if (stat(filename, &info) != 0)
}
isdir = (info.st_mode & S_IFDIR) != 0;
if (wadinfo == NULL && !isdir)
{
try
{ {
wadinfo = new FileReader(filename); Printf(TEXTCOLOR_RED "Could not stat %s\n", filename);
} PrintLastError();
catch (CRecoverableError &err)
{ // Didn't find file
Printf (TEXTCOLOR_RED "%s\n", err.GetMessage());
PrintLastError ();
return; return;
} }
isdir = (info.st_mode & S_IFDIR) != 0;
if (!isdir)
{
try
{
wadinfo = new FileReader(filename);
}
catch (CRecoverableError &err)
{ // Didn't find file
Printf (TEXTCOLOR_RED "%s\n", err.GetMessage());
PrintLastError ();
return;
}
}
} }
Printf (" adding %s", filename); Printf (" adding %s", filename);
@ -294,7 +297,7 @@ void FWadCollection::AddFile (const char *filename, FileReader *wadinfo)
FileReader *embedded = lump->NewReader(); FileReader *embedded = lump->NewReader();
strcpy(wadstr, lump->FullName); strcpy(wadstr, lump->FullName);
AddFile(wadstr, embedded); AddFile(path, embedded);
} }
} }
return; return;