35 Star 50 Fork 12

白乔 / πFlow

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
ShellRunner.scala 955 Bytes
Copy Edit Web IDE Raw Blame History
package cn.piflow.shell
import java.io.{File, FilenameFilter}
import cn.piflow.FlowException
import scala.collection.mutable.ArrayBuffer
object ShellRunner {
def main(args: Array[String]) {
val classPath2 = if (args.length >= 1) {
formatClassPath(args(0));
}
else {
null;
}
println("starting piflow shell...");
new Shell().run(classPath2);
}
def formatClassPath(cp: String): String = {
val sb = new ArrayBuffer[String]();
cp.trim.split("[\r\n\t:;]").map(_.trim).filter(!_.isEmpty).
foreach { path: String =>
val file = new File(path).getCanonicalFile;
val path2 = file.getAbsolutePath;
if (!file.exists()) {
throw new FlowException(s"wrong path: $path2");
}
sb += path2;
if (file.isDirectory) {
sb ++= file.listFiles(new FilenameFilter {
def accept(dir: File, name: String) = name.endsWith(".jar");
}).map(_.getAbsolutePath);
}
}
sb.toArray.reduce(_ + ":" + _);
}
}

Comment ( 0 )

Sign in for post a comment

Scala
1
https://gitee.com/bluejoe/piflow.git
git@gitee.com:bluejoe/piflow.git
bluejoe
piflow
πFlow
master

Search