|
| 1 | +import java.io.BufferedReader; |
1 | 2 | import java.io.File;
|
2 | 3 | import java.io.FileInputStream;
|
3 | 4 | import java.io.FileWriter;
|
@@ -27,16 +28,17 @@ public static void main(String[]a)throws Exception{
|
27 | 28 | builder.append(in.substring(0, in.indexOf("```shell")+8)).append("\n");
|
28 | 29 | in=in.substring(in.indexOf("```shell")+8);
|
29 | 30 | in=in.substring(in.indexOf("```"));
|
30 | | - final Process proc=Runtime.getRuntime().exec("tree -a -I .git "+System.getProperty("user.dir")+"/.."); |
| 31 | + final Process proc=Runtime.getRuntime().exec("tree -a -I .git --noreport "+System.getProperty("user.dir")+"/.."); |
31 | 32 | try{
|
32 | 33 | proc.waitFor();
|
33 | 34 | }catch(Exception e){}
|
34 | | - try(final Scanner outputReader=new Scanner(new InputStreamReader(proc.getInputStream()))){ |
| 35 | + try(final BufferedReader outputReader=new BufferedReader(new InputStreamReader(proc.getInputStream()))){ |
35 | 36 | final Pattern dirHeader=Pattern.compile("^/.*");
|
36 | | - while(outputReader.hasNext()){ |
37 | | - final String line=dirHeader.matcher(outputReader.nextLine()).replaceAll(""); |
38 | | - if(!line.isEmpty()&&outputReader.hasNext()) |
39 | | - builder.append(" ").append(line+"\n"); |
| 37 | + String line; |
| 38 | + while((line=outputReader.readLine())!=null){ |
| 39 | + line=dirHeader.matcher(line).replaceAll(""); |
| 40 | + if(!line.isEmpty()) |
| 41 | + builder.append(" ").append(line).append("\n"); |
40 | 42 | }
|
41 | 43 | }
|
42 | 44 | builder.append(in);
|
|
0 commit comments