Skip to content

Commit

Permalink
- fixed directory loader.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Aug 23, 2023
1 parent c6e2e0a commit e0b3bda
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ else()
set( NOT_COMPILED_SOURCE_FILES ${NOT_COMPILED_SOURCE_FILES} ${VM_JIT_SOURCES} )
endif()

set( ZDOOM_SOURCES
set( GAME_SOURCES
${HEADER_FILES}
${NOT_COMPILED_SOURCE_FILES}
${SYSTEM_SOURCES}
Expand Down Expand Up @@ -1227,8 +1227,8 @@ set( ZDOOM_SOURCES

)

set( ZDOOM_NONPCH_SOURCES ${ZDOOM_SOURCES} )
list( REMOVE_ITEM ZDOOM_NONPCH_SOURCES ${PCH_SOURCES} )
set( GAME_NONPCH_SOURCES ${GAME_SOURCES} )
list( REMOVE_ITEM GAME_NONPCH_SOURCES ${PCH_SOURCES} )

add_executable( zdoom WIN32 MACOSX_BUNDLE ${ZDOOM_SOURCES} )

Expand All @@ -1238,7 +1238,7 @@ set_source_files_properties( ${FASTMATH_SOURCES} PROPERTIES COMPILE_FLAGS ${ZD_F
set_source_files_properties( xlat/parse_xlat.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.c" )
set_source_files_properties( common/engine/sc_man.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h" )
set_source_files_properties( ${NOT_COMPILED_SOURCE_FILES} PROPERTIES HEADER_FILE_ONLY TRUE )
set_source_files_properties( ${ZDOOM_NONPCH_SOURCES} common/textures/hires/hqresize.cpp PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE )
set_source_files_properties( ${GAME_NONPCH_SOURCES} common/textures/hires/hqresize.cpp PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE )


if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
Expand Down Expand Up @@ -1418,9 +1418,9 @@ if( APPLE )
endif()

if( WIN32 )
set( INSTALL_PATH . CACHE STRING "Directory where the zdoom executable will be placed during install." )
set( INSTALL_PATH . CACHE STRING "Directory where the executable will be placed during install." )
else()
set( INSTALL_PATH bin CACHE STRING "Directory where the zdoom executable will be placed during install." )
set( INSTALL_PATH bin CACHE STRING "Directory where the executable will be placed during install." )
endif()
install(TARGETS zdoom
DESTINATION ${INSTALL_PATH}
Expand Down
16 changes: 8 additions & 8 deletions src/common/filesystem/source/file_directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct FDirectoryLump : public FResourceLump
FileReader NewReader() override;
int FillCache() override;

std::string mFullPath;
const char* mFullPath;
};


Expand All @@ -75,7 +75,7 @@ class FDirectory : public FResourceFile
const bool nosubdir;

int AddDirectory(const char* dirpath, LumpFilterInfo* filter, FileSystemMessageFunc Printf);
void AddEntry(const char *fullpath, int size);
void AddEntry(const char *fullpath, const char* relpath, int size);

public:
FDirectory(const char * dirname, StringPool* sp, bool nosubdirflag = false);
Expand Down Expand Up @@ -135,7 +135,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy
Printf(FSMessageLevel::Warning, "%s is larger than 2GB and will be ignored\n", entry.FilePath.c_str());
continue;
}
AddEntry(entry.FilePathRel.c_str(), (int)entry.Length);
AddEntry(entry.FilePath.c_str(), entry.FilePathRel.c_str(), (int)entry.Length);
count++;
}
}
Expand Down Expand Up @@ -163,15 +163,15 @@ bool FDirectory::Open(LumpFilterInfo* filter, FileSystemMessageFunc Printf)
//
//==========================================================================

void FDirectory::AddEntry(const char *fullpath, int size)
void FDirectory::AddEntry(const char *fullpath, const char* relpath, 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;
lump_p->mFullPath = stringpool->Strdup(fullpath);

// [mxd] Convert name to lowercase
std::string name = fullpath + strlen(FileName);
std::string name = relpath;
for (auto& c : name) c = tolower(c);

// The lump's name is only the part relative to the main directory
Expand All @@ -192,7 +192,7 @@ void FDirectory::AddEntry(const char *fullpath, int size)
FileReader FDirectoryLump::NewReader()
{
FileReader fr;
fr.OpenFile(mFullPath.c_str());
fr.OpenFile(mFullPath);
return fr;
}

Expand All @@ -206,7 +206,7 @@ int FDirectoryLump::FillCache()
{
FileReader fr;
Cache = new char[LumpSize];
if (!fr.OpenFile(mFullPath.c_str()))
if (!fr.OpenFile(mFullPath))
{
throw FileSystemException("unable to open file");
}
Expand Down

0 comments on commit e0b3bda

Please sign in to comment.