Skip to content

Commit

Permalink
simplified the directory reader a little bit
Browse files Browse the repository at this point in the history
* we do not need to make a second allocation for the systemFilePath
* as systemFilePath is never null, there is no need to check for that case.
  • Loading branch information
coelckers committed Dec 24, 2023
1 parent f8dcc33 commit ac2cf1b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/common/filesystem/source/file_directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy
}
// for internal access we use the normalized form of the relative path.
Entries[count].FileName = NormalizeFileName(entry.FilePathRel.c_str());
Entries[count].SystemFilePath = stringpool->Strdup(Entries[count].FileName);
Entries[count].SystemFilePath = FileName;
Entries[count].CompressedSize = Entries[count].Length = entry.Length;
Entries[count].Flags = RESFF_FULLPATH;
Entries[count].ResourceID = -1;
Expand Down Expand Up @@ -170,9 +170,7 @@ FileReader FDirectory::GetEntryReader(uint32_t entry, int readertype, int)
if (entry < NumLumps)
{
std::string fn = mBasePath;
fn += Entries[entry].SystemFilePath ?
Entries[entry].SystemFilePath :
Entries[entry].FileName;
fn += Entries[entry].SystemFilePath;
fr.OpenFile(fn.c_str());
if (readertype == READER_CACHED)
{
Expand Down

0 comments on commit ac2cf1b

Please sign in to comment.