Showing the changes to java/tools/genpkg/GenerateMkfile.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,32 @@ | |||
| 1 | |||
| 2 | import java.io.*; | ||
| 3 | |||
| 4 | public class GenerateMkfile { | ||
| 5 | |||
| 6 | public static void main(String[] args) { | ||
| 7 | if (args.length == 0) { | ||
| 8 | System.out.println("Generates or updates the mkfile for java"); | ||
| 9 | System.out.println("package in inferno java subsystem."); | ||
| 10 | System.out.println(); | ||
| 11 | System.out.println("Usage: specify the package dir"); | ||
| 12 | return; | ||
| 13 | } | ||
| 14 | |||
| 15 | File dir = new File(args[0]); | ||
| 16 | if (!dir.exists() || !dir.isDirectory()) { | ||
| 17 | System.out.println("The path must be existing directory"); | ||
| 18 | return; | ||
| 19 | } | ||
| 20 | |||
| 21 | StringBuilder result = new StringBuilder(); | ||
| 22 | result.append("TARG=\\").append('\n'); | ||
| 23 | |||
| 24 | File[] files = dir.listFiles(); | ||
| 25 | for (File f: files) { | ||
| 26 | if (f.isFile() && f.getName().endsWith(".java")) | ||
| 27 | result.append('\t').append(f.getName()).append("\\\n"); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | } | ||
| 32 | |||