aboutsummaryrefslogtreecommitdiff
path: root/stage1
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2017-03-19 20:54:21 -0400
committerChristopher Vogt <oss.nsp@cvogt.org>2017-03-27 23:54:16 -0400
commitac92c2af65a064da2a6ac94d30071ba6aa8ac04d (patch)
tree4c2da9a1d75f331cf0e3c952e83deb4c5800a41d /stage1
parentb0385cedf55c3e04171f12ce2775010a269800a5 (diff)
downloadcbt-ac92c2af65a064da2a6ac94d30071ba6aa8ac04d.tar.gz
cbt-ac92c2af65a064da2a6ac94d30071ba6aa8ac04d.tar.bz2
cbt-ac92c2af65a064da2a6ac94d30071ba6aa8ac04d.zip
performance: avoid io call when building classpath string
Diffstat (limited to 'stage1')
-rw-r--r--stage1/ClassPath.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/stage1/ClassPath.scala b/stage1/ClassPath.scala
index d8568c2..539efc7 100644
--- a/stage1/ClassPath.scala
+++ b/stage1/ClassPath.scala
@@ -22,6 +22,9 @@ case class ClassPath(files: Seq[File] = Seq()){
def ++(other: ClassPath) = ClassPath(files ++ other.files)
def string = strings.mkString( File.pathSeparator )
def strings = files.map{
- f => f.string ++ ( if(f.isDirectory) "/" else "" )
+ f => f.string + (
+ // using file extension instead of isDirectory for performance reasons
+ if( f.getName.endsWith(".jar") /* !f.isDirectory */ ) "" else "/"
+ )
}.sorted
}