File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
src/compiler/scala/tools/nsc/interpreter Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -591,32 +591,31 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
591
591
}
592
592
}
593
593
594
- def withFile (filename : String )(action : File => Unit ) {
595
- val f = File (filename)
594
+ def smartPath (path : String ) = if (File (path).exists) path else path.trim
595
+
596
+ def withPath (path : String )(action : File => Unit ) {
597
+ val f = File (path)
596
598
597
599
if (f.exists) action(f)
598
- else echo(" \" " + filename + " \" does not appear to exist" )
600
+ else echo(" The path ' " + f + " ' doesn't seem to exist. " )
599
601
}
600
602
601
603
def loadCommand (arg : String ) = {
602
- val smartArg = if (File (arg).exists) arg else arg.trim
603
604
var shouldReplay : Option [String ] = None
604
- withFile(smartArg )(f => {
605
+ withPath(smartPath(arg) )(f => {
605
606
interpretAllFrom(f)
606
607
shouldReplay = Some (" :load " + arg)
607
608
})
608
609
Result (true , shouldReplay)
609
610
}
610
611
611
612
def addClasspath (arg : String ): Unit = {
612
- val f = File (arg).normalize
613
- if (f.exists) {
613
+ withPath(File (arg).normalize.path)(f => {
614
614
addedClasspath = ClassPath .join(addedClasspath, f.path)
615
615
val totalClasspath = ClassPath .join(settings.classpath.value, addedClasspath)
616
616
echo(" Added '%s'. Your new classpath is:\n\" %s\" " .format(f.path, totalClasspath))
617
617
replay()
618
- }
619
- else echo(" The path '" + f + " ' doesn't seem to exist." )
618
+ })
620
619
}
621
620
622
621
def powerCmd (): Result = {
You can’t perform that action at this time.
0 commit comments