From 8d0128698a9476f1fd8f79587bf42b63aa00d052 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Mon, 11 Oct 2021 19:02:58 -0400 Subject: [PATCH] * [ZIPVolume] BugFix: Add the capability of resolving ZIP prefix paths with case insensitivity and a CMake option to control this behavior. --- Engine/source/core/util/zip/zipVolume.cpp | 9 ++++++++- Tools/CMake/torque3d.cmake | 3 +++ Tools/CMake/torqueConfig.h.in | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Engine/source/core/util/zip/zipVolume.cpp b/Engine/source/core/util/zip/zipVolume.cpp index 5dcb8dee8..a3a0ac7c9 100644 --- a/Engine/source/core/util/zip/zipVolume.cpp +++ b/Engine/source/core/util/zip/zipVolume.cpp @@ -407,8 +407,15 @@ FileNodeRef ZipFileSystem::resolve(const Path& path) if(mZipNameIsDir) { // Remove the fake root from the name so things can be found +#ifdef TORQUE_ZIP_PATH_CASE_INSENSITIVE + String lowerFakeRoot = String::ToLower(mFakeRoot); + String lowerName = String::ToLower(name); + if(lowerName.find(lowerFakeRoot) == 0) + name = name.substr(mFakeRoot.length()); +#else if(name.find(mFakeRoot) == 0) - name = name.substr(mFakeRoot.length()); + name = name.substr(mFakeRoot.length()); +#endif #ifdef TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP else diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index 460d32e51..cd09fabd6 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -166,6 +166,9 @@ mark_as_advanced(TORQUE_MULTITHREAD) option(TORQUE_POSIX_PATH_CASE_INSENSITIVE ON) mark_as_advanced(TORQUE_POSIX_PATH_CASE_INSENSITIVE) +option(TORQUE_ZIP_PATH_CASE_INSENSITIVE ON) +mark_as_advanced(TORQUE_ZIP_PATH_CASE_INSENSITIVE) + option(TORQUE_DISABLE_MEMORY_MANAGER "Disable memory manager" ON) mark_as_advanced(TORQUE_DISABLE_MEMORY_MANAGER) diff --git a/Tools/CMake/torqueConfig.h.in b/Tools/CMake/torqueConfig.h.in index 6465012c4..9e045b1d5 100644 --- a/Tools/CMake/torqueConfig.h.in +++ b/Tools/CMake/torqueConfig.h.in @@ -47,6 +47,9 @@ /// Define me if you want path case insensitivity support on POSIX systems. Does nothing on Windows. #cmakedefine TORQUE_POSIX_PATH_CASE_INSENSITIVE +/// Define me if you want path case insensitivity support in ZIP files. +#cmakedefine TORQUE_ZIP_PATH_CASE_INSENSITIVE + /// Define me if you want to enable multithreading support. #cmakedefine TORQUE_MULTITHREAD