Scala: changed Test to use current dir

This commit is contained in:
2022-08-16 22:49:21 +02:00
parent 7fa3b3ff82
commit b0cbd6fe49
3 changed files with 7 additions and 6 deletions

View File

@@ -6,10 +6,10 @@ import java.util.List;
public class Test { public class Test {
// //
private static String CORNER = " └── "; private static String CORNER = "└── ";
private static String BLANK = " "; private static String BLANK = " ";
private static String JUNCTION = " ├── "; private static String JUNCTION = "├── ";
private static String LINE = " "; private static String LINE = "";
static void recurse(Directory d, int level) { static void recurse(Directory d, int level) {
List<Directory> subs = d.children; List<Directory> subs = d.children;
@@ -24,7 +24,7 @@ public class Test {
while (temp.parent != null) { while (temp.parent != null) {
if (temp.parent.children.indexOf(temp) == temp.parent.children.size() - 1) { if (temp.parent.children.indexOf(temp) == temp.parent.children.size() - 1) {
if (loop == 0) { if (loop == 0) {
s = CORNER + s; s = CORNER + s;
} else { } else {
s = BLANK + s; s = BLANK + s;
} }

View File

@@ -41,7 +41,7 @@ object Test extends App {
} }
} }
val dir = new Directory(new File("/home/rob")) val dir = new Directory(new File(if (args.length > 0) args(0) else "."))
val s = "%,16d".format(dir.totalSize) + " " + dir.fsdir.getCanonicalPath val s = "%,16d".format(dir.totalSize) + " " + dir.fsdir.getCanonicalPath
println(s) println(s)
recurse(dir, 1) recurse(dir, 1)

View File

@@ -7,5 +7,6 @@
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="scala-sdk-2.13.6" level="application" />
</component> </component>
</module> </module>