Zip usage notes and defines.

This commit is contained in:
OTHGMars 2021-01-11 05:04:36 -05:00
parent 8148bdfcdd
commit c77be80220
3 changed files with 29 additions and 5 deletions

View file

@ -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;

View file

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

View file

@ -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