MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / resolve

Method resolve

Engine/source/core/util/zip/zipVolume.cpp:392–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

390}
391
392FileNodeRef ZipFileSystem::resolve(const Path& path)
393{
394 if (!mInitted)
395 _init();
396
397 if (mZipArchive.isNull())
398 return NULL;
399
400 // eat leading "/"
401 String name = path.getFullPathWithoutRoot();
402 if (name.find("/") == 0)
403 name = name.substr(1, name.length() - 1);
404
405 if(name.isEmpty() && mZipNameIsDir)
406 return new ZipFakeRootNode(mZipArchive, path, mFakeRoot);
407#ifdef TORQUE_LOWER_ZIPCASE
408 name = String::ToLower(name);
409#endif
410 if(mZipNameIsDir)
411 {
412 // Remove the fake root from the name so things can be found
413#ifdef TORQUE_ZIP_PATH_CASE_INSENSITIVE
414 String lowerFakeRoot = String::ToLower(mFakeRoot);
415 String lowerName = String::ToLower(name);
416 if(lowerName.find(lowerFakeRoot) == 0)
417 name = name.substr(mFakeRoot.length());
418#else
419 if(name.find(mFakeRoot) == 0)
420 name = name.substr(mFakeRoot.length());
421#endif
422
423#ifdef TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
424 else
425 // If a zip file's name isn't the root of the path we're looking for
426 // then do not continue. Otherwise, we'll continue to look for the
427 // path's root within the zip file itself. i.e. we're looking for the
428 // path "scripts/test.cs". If the zip file itself isn't called scripts.zip
429 // then we won't look within the archive for a "scripts" directory.
430 return NULL;
431#endif
432
433 if (name.find("/") == 0)
434 name = name.substr(1, name.length() - 1);
435 }
436
437 // first check to see if input path is a directory
438 // check for request of root directory
439 if (name.isEmpty())
440 {
441 ZipDirectoryNode* zdn = new ZipDirectoryNode(mZipArchive, path, mZipArchive->getRoot());
442 return zdn;
443 }
444
445 ZipArchive::ZipEntry* ze = mZipArchive->findZipEntry(name);
446 if (ze == NULL)
447 return NULL;
448
449 if (ze->mIsDirectory)

Callers

nothing calls this directly

Calls 11

_initFunction · 0.85
substrMethod · 0.80
findZipEntryMethod · 0.80
ToLowerFunction · 0.50
isNullMethod · 0.45
findMethod · 0.45
lengthMethod · 0.45
isEmptyMethod · 0.45
getRootMethod · 0.45
openFileMethod · 0.45

Tested by

no test coverage detected