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)
591591 }
592592 }
593593
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)
596598
597599 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. " )
599601 }
600602
601603 def loadCommand (arg : String ) = {
602- val smartArg = if (File (arg).exists) arg else arg.trim
603604 var shouldReplay : Option [String ] = None
604- withFile(smartArg )(f => {
605+ withPath(smartPath(arg) )(f => {
605606 interpretAllFrom(f)
606607 shouldReplay = Some (" :load " + arg)
607608 })
608609 Result (true , shouldReplay)
609610 }
610611
611612 def addClasspath (arg : String ): Unit = {
612- val f = File (arg).normalize
613- if (f.exists) {
613+ withPath(File (arg).normalize.path)(f => {
614614 addedClasspath = ClassPath .join(addedClasspath, f.path)
615615 val totalClasspath = ClassPath .join(settings.classpath.value, addedClasspath)
616616 echo(" Added '%s'. Your new classpath is:\n\" %s\" " .format(f.path, totalClasspath))
617617 replay()
618- }
619- else echo(" The path '" + f + " ' doesn't seem to exist." )
618+ })
620619 }
621620
622621 def powerCmd (): Result = {
You can’t perform that action at this time.
0 commit comments