Преглед на файлове

Zip usage notes and defines.

OTHGMars преди 4 години
родител
ревизия
c77be80220
променени са 3 файла, в които са добавени 29 реда и са изтрити 5 реда
  1. 8 2
      Engine/source/core/virtualMountSystem.cpp
  2. 6 0
      Tools/CMake/torque3d.cmake
  3. 15 3
      Tools/CMake/torqueConfig.h.in

+ 8 - 2
Engine/source/core/virtualMountSystem.cpp

@@ -39,7 +39,9 @@ bool VirtualMountSystem::mount(String root, FileSystemRef fs)
    if (!ok)
       return false;
 
+#ifdef TORQUE_LOWER_ZIPCASE
    root = String::ToLower(root);
+#endif
 
    mRootMap[root].push_back(fs);
 
@@ -263,13 +265,17 @@ FileSystemRef VirtualMountSystem::_removeMountFromList(String root)
 
 FileSystemRef VirtualMountSystem::_getFileSystemFromList(const Path& fullpath) const 
 {
-   String root = String::ToLower(fullpath.getRoot());
+   String root = fullpath.getRoot();
    String path = fullpath.getFullPathWithoutRoot();
    // eat leading slash
    if (path[(String::SizeType)0] == '/')
       path = path.substr(1);
-   // lowercase it
+
+#ifdef TORQUE_LOWER_ZIPCASE
+   // lowercase the root and path
+   root = String::ToLower(root);
    path = String::ToLower(path);
+#endif
 
    // find the dictionary for root
 //    PathFSMap* rootDict = NULL;

+ 6 - 0
Tools/CMake/torque3d.cmake

@@ -169,6 +169,12 @@ mark_as_advanced(TORQUE_DISABLE_MEMORY_MANAGER)
 option(TORQUE_DISABLE_VIRTUAL_MOUNT_SYSTEM "Disable virtual mount system" OFF)
 mark_as_advanced(TORQUE_DISABLE_VIRTUAL_MOUNT_SYSTEM)
 
+option(TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP "Disable reading root path from zip. Zips will be mounted in-place with file name as directory name." ON)
+mark_as_advanced(TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP)
+
+option(TORQUE_ZIP_DISK_LAYOUT "All zips must be placed in the executable directory and contain full paths to the files." OFF)
+mark_as_advanced(TORQUE_ZIP_DISK_LAYOUT)
+
 option(TORQUE_PLAYER "Playback only?" OFF)
 mark_as_advanced(TORQUE_PLAYER)
 

+ 15 - 3
Tools/CMake/torqueConfig.h.in

@@ -56,13 +56,25 @@
 /// Define me if you want to disable looking for the root of a given path
 /// within a zip file.  This means that the zip file name itself must be
 /// the root of the path.  Requires the virtual mount system to be active.
+/// i.e. data/ui.zip would be mounted as data/ui, so the zip should not
+/// contain the ui folder, only it's contents. The one exception to this
+/// is if a file game.zip is located in the executable directory. The zip
+/// name 'game' will NOT be added as an extra directory.
 #cmakedefine TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
 
-//Uncomment this define if you want to use the alternative zip support where you can 
-//define your directories and files inside the zip just like you would on disk
-//instead of the default zip support that treats the zip as an extra directory.
+/// Define me if you want to use the alternative zip support where you can 
+/// define your directories and files inside the zip just like you would on disk
+/// instead of the default zip support that treats the zip as an extra directory.
+/// With this define, all zips should be placed in the executable directory and
+/// contain the full path structure to the files.
 #cmakedefine TORQUE_ZIP_DISK_LAYOUT
 
+/// If this is defined all zip file names and mount directories will need to
+/// be all lower case (even on windows). This is because the root map
+/// mRootMap.tryGetValue(root, fsList) call is case sensitive. Define to match
+/// legacy zip case behavior.
+/* #undef TORQUE_LOWER_ZIPCASE */
+
 /// Define me if you don't want Torque to compile dso's
 #cmakedefine TORQUE_NO_DSO_GENERATION