- fixed directory loader.

This commit is contained in:
Christoph Oelckers 2023-08-23 22:09:58 +02:00
parent c6e2e0add2
commit e0b3bdaadc
2 changed files with 14 additions and 14 deletions

View file

@ -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}
@ -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} )
@ -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")
@ -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}

View file

@ -59,7 +59,7 @@ struct FDirectoryLump : public FResourceLump
FileReader NewReader() override;
int FillCache() override;
std::string mFullPath;
const char* mFullPath;
};
@ -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);
@ -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++;
}
}
@ -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
@ -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;
}
@ -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");
}