MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / _getURLFromPath

Method _getURLFromPath

src/javajs/async/Assets.java:438–467  ·  view source on GitHub ↗
(String fullPath, boolean zipOnly)

Source from the content-addressed store, hash-verified

436 }
437
438 private URL _getURLFromPath(String fullPath, boolean zipOnly) {
439 URL url = null;
440 try {
441 if (!fullPath.startsWith("/TEMP/")) {
442 if (fullPath.startsWith("/"))
443 fullPath = fullPath.substring(1);
444 for (int i = sortedList.length; --i >= 0;) {
445 if (fullPath.startsWith(sortedList[i])) {
446 url = assetsByPath.get(sortedList[i]).getURL(fullPath);
447 ZipEntry ze = findZipEntry(url);
448 if (ze == null) {
449 url = null;
450 break;
451 }
452 if (isJS) {
453 jsutil.setURLBytes(url, jsutil.getZipBytes(ze));
454 }
455 break;
456 }
457 }
458 }
459 if (url == null && !zipOnly)
460 url = getAbsoluteURL((fullPath.startsWith("TEMP/") ? "/" + fullPath : fullPath));
461 } catch (MalformedURLException e) {
462 }
463 if (debugging) {
464 System.out.println("Assets.getURLFromPath " + url);
465 }
466 return url;
467 }
468
469 public static ZipEntry findZipEntry(URL url) {
470 if (url == null)

Callers 3

getAssetBytesMethod · 0.80
getAssetStreamMethod · 0.80
getURLFromPathMethod · 0.80

Calls 7

findZipEntryMethod · 0.95
getAbsoluteURLMethod · 0.95
setURLBytesMethod · 0.80
getZipBytesMethod · 0.80
getMethod · 0.65
printlnMethod · 0.65
getURLMethod · 0.45

Tested by

no test coverage detected