mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-16 09:11:17 +00:00
- fixed: Lumps from a directory need to store the full file path so that they still can be accessed when the internal path is changed due to a filter directory.
This commit is contained in:
parent
6428b399d6
commit
9b95c134a7
1 changed files with 9 additions and 4 deletions
|
@ -72,7 +72,7 @@ struct FDirectoryLump : public FResourceLump
|
|||
virtual FileReader *NewReader();
|
||||
virtual int FillCache();
|
||||
|
||||
private:
|
||||
FString mFullPath;
|
||||
};
|
||||
|
||||
|
||||
|
@ -300,6 +300,8 @@ void FDirectory::AddEntry(const char *fullpath, int size)
|
|||
{
|
||||
FDirectoryLump *lump_p = &Lumps[Lumps.Reserve(1)];
|
||||
|
||||
// Store the full path here so that we can access the file later, even if it is from a filter directory.
|
||||
lump_p->mFullPath = fullpath;
|
||||
// The lump's name is only the part relative to the main directory
|
||||
lump_p->LumpNameSetup(fullpath + strlen(Filename));
|
||||
lump_p->LumpSize = size;
|
||||
|
@ -319,9 +321,7 @@ FileReader *FDirectoryLump::NewReader()
|
|||
{
|
||||
try
|
||||
{
|
||||
FString fullpath = Owner->Filename;
|
||||
fullpath += FullName;
|
||||
return new FileReader(fullpath);
|
||||
return new FileReader(mFullPath);
|
||||
}
|
||||
catch (CRecoverableError &)
|
||||
{
|
||||
|
@ -339,6 +339,11 @@ int FDirectoryLump::FillCache()
|
|||
{
|
||||
Cache = new char[LumpSize];
|
||||
FileReader *reader = NewReader();
|
||||
if (reader == NULL)
|
||||
{
|
||||
memset(Cache, 0, sizeof(Cache));
|
||||
return 0;
|
||||
}
|
||||
reader->Read(Cache, LumpSize);
|
||||
delete reader;
|
||||
RefCount = 1;
|
||||
|
|
Loading…
Reference in a new issue