Ver código fonte

* [ZIPVolume] BugFix: Add the capability of resolving ZIP prefix paths with case insensitivity and a CMake option to control this behavior.

Robert MacGregor 3 anos atrás
pai
commit
8d0128698a

+ 8 - 1
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

+ 3 - 0
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)
 

+ 3 - 0
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