dir command as in MS-DOS - shows contents of the directory @param args wildcard, can contain a subpath also, like 'dir players/cyborg/ . '. TODO: support dir of pak files TODO: support links
(List<String> args)
| 692 | * TODO: support links |
| 693 | */ |
| 694 | private static void Dir_f(List<String> args) { |
| 695 | // |
| 696 | String wildcard = "*.*"; |
| 697 | |
| 698 | if (args.size() >= 2) { |
| 699 | wildcard = args.get(1); |
| 700 | } |
| 701 | |
| 702 | for (SearchPath s : searchPaths) { |
| 703 | if (s.pack != null) |
| 704 | continue; |
| 705 | String path = s.filename; |
| 706 | |
| 707 | String findname = path + '/' + wildcard; |
| 708 | |
| 709 | String[] dirnames = ListFiles(findname, 0, 0); |
| 710 | |
| 711 | if (dirnames != null && dirnames.length > 0) { |
| 712 | Com.Printf("Directory of " + findname + '\n'); |
| 713 | for (String dirname : dirnames) { |
| 714 | int index; |
| 715 | if ((index = dirname.lastIndexOf('/')) > 0) { |
| 716 | Com.Printf(" " + dirname.substring(index + 1) + '\n'); |
| 717 | } else { |
| 718 | Com.Printf(" " + dirname + '\n'); |
| 719 | } |
| 720 | } |
| 721 | Com.Printf("\n"); |
| 722 | |
| 723 | } |
| 724 | } |
| 725 | } |
| 726 | |
| 727 | /** |
| 728 | * Shows all current search paths and links |