MCPcopy Create free account
hub / github.com/Card-Forge/forge / findFile

Method findFile

forge-core/src/main/java/forge/ImageKeys.java:382–407  ·  view source on GitHub ↗
(String dir, String filename)

Source from the content-addressed store, hash-verified

380 return null;
381 }
382 private static File findFile(String dir, String filename) {
383 if (dir.equals(CACHE_CARD_PICS_DIR)) {
384 for (String ext : FILE_EXTENSIONS) {
385 if (ext.isEmpty())
386 continue;
387
388 File f = new File(dir, filename + ext);
389 if (f.exists()) {
390 return f;
391 }
392 }
393 } else {
394 //old method for tokens and others
395 for (String ext : FILE_EXTENSIONS) {
396 File file = new File(dir, filename + ext);
397 if (file.exists()) {
398 if (file.isDirectory()) {
399 file.delete();
400 continue;
401 }
402 return file;
403 }
404 }
405 }
406 return null;
407 }
408
409 //shortcut for determining if a card image exists for a given card
410 //should only be called from PaperCard.hasImage()

Callers 1

getImageFileMethod · 0.95

Calls 3

isEmptyMethod · 0.65
deleteMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected