mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
Reworked check for embedded WADs put inside directory within archive
Any WAD from directory named the same as archive are treated as embedded Fixed the issue with archive filename that wasn't taken into account
This commit is contained in:
parent
7ae3678abc
commit
9df56216b3
1 changed files with 13 additions and 7 deletions
|
@ -150,22 +150,28 @@ void FResourceLump::LumpNameSetup(const char *iname)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
static bool IsWadInFolder(const char* const fullName)
|
static bool IsWadInFolder(const FResourceFile* const archive, const char* const resPath)
|
||||||
{
|
{
|
||||||
// Checks a special case when <myfile.wad> was put in
|
// Checks a special case when <somefile.wad> was put in
|
||||||
// <myfile> directory inside <myfile.zip>
|
// <myproject> directory inside <myproject.zip>
|
||||||
|
|
||||||
const FString baseName = ExtractFileBase(fullName);
|
if (NULL == archive)
|
||||||
const FString fileName = baseName + '/' + baseName + ".wad";
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return 0 == fileName.CompareNoCase(fullName);
|
const FString dirName = ExtractFileBase(archive->Filename);
|
||||||
|
const FString fileName = ExtractFileBase(resPath, true);
|
||||||
|
const FString filePath = dirName + '/' + fileName;
|
||||||
|
|
||||||
|
return 0 == filePath.CompareNoCase(resPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FResourceLump::CheckEmbedded()
|
void FResourceLump::CheckEmbedded()
|
||||||
{
|
{
|
||||||
// Checks for embedded archives
|
// Checks for embedded archives
|
||||||
const char *c = strstr(FullName, ".wad");
|
const char *c = strstr(FullName, ".wad");
|
||||||
if (c && strlen(c) == 4 && (!strchr(FullName, '/') || IsWadInFolder(FullName)))
|
if (c && strlen(c) == 4 && (!strchr(FullName, '/') || IsWadInFolder(Owner, FullName)))
|
||||||
{
|
{
|
||||||
// Mark all embedded WADs
|
// Mark all embedded WADs
|
||||||
Flags |= LUMPF_EMBEDDED;
|
Flags |= LUMPF_EMBEDDED;
|
||||||
|
|
Loading…
Reference in a new issue