MCPcopy Create free account
hub / github.com/demoth/jake2 / Link_f

Method Link_f

qcommon/src/main/java/jake2/qcommon/filesystem/FS.java:639–667  ·  view source on GitHub ↗
(List<String> args)

Source from the content-addressed store, hash-verified

637 * Creates a filelink_t
638 */
639 private static void Link_f(List<String> args) {
640
641 if (args.size() != 3) {
642 Com.Printf("USAGE: link <from> <to>\n");
643 return;
644 }
645
646 // see if the link already exists
647 String from = args.get(1);
648 String to = args.get(2);
649 for (Iterator<filelink_t> it = fs_links.iterator(); it.hasNext();) {
650 filelink_t entry = it.next();
651
652 if (entry.from.equals(from)) {
653 if (to.isEmpty()) {
654 // delete it
655 it.remove();
656 return;
657 }
658 entry.to = to;
659 return;
660 }
661 }
662
663 // create a new link if the <to> is not empty
664 if (!to.isEmpty()) {
665 fs_links.add(new filelink_t(from, to));
666 }
667 }
668
669 /*
670 * ListFiles

Callers

nothing calls this directly

Calls 8

PrintfMethod · 0.95
sizeMethod · 0.80
hasNextMethod · 0.80
nextMethod · 0.80
removeMethod · 0.80
getMethod · 0.45
equalsMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected