summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-07-08 07:57:42 +0000
committerGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-07-08 07:57:42 +0000
commitbc5ef919c02ba95163f093e624dadbc17ae1bbdf (patch)
treec11b638943fb81bc7315f2a24436c8463dbebce2
parent82fa132d6bf74589a925b1b4ae75113180dbd22a (diff)
downloadscala-bc5ef919c02ba95163f093e624dadbc17ae1bbdf.tar.gz
scala-bc5ef919c02ba95163f093e624dadbc17ae1bbdf.tar.bz2
scala-bc5ef919c02ba95163f093e624dadbc17ae1bbdf.zip
Fixed r15497 to handle the case where a file th...
Fixed r15497 to handle the case where a file that doesn't end in ".scala" already exists.
-rw-r--r--src/compiler/scala/tools/nsc/InterpreterLoop.scala11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/InterpreterLoop.scala b/src/compiler/scala/tools/nsc/InterpreterLoop.scala
index af4b2052be..c0fcee0bc8 100644
--- a/src/compiler/scala/tools/nsc/InterpreterLoop.scala
+++ b/src/compiler/scala/tools/nsc/InterpreterLoop.scala
@@ -197,13 +197,14 @@ class InterpreterLoop(in0: Option[BufferedReader], out: PrintWriter) {
out.println("That command requires a filename to be specified.")
return ()
}
- val name = command.substring(spaceIdx).trim
- val filename = if(name.toLowerCase endsWith ".scala") name else (name + ".scala")
- if (! new File(filename).exists) {
+ val filename = command.substring(spaceIdx).trim
+ if (new File(filename).exists)
+ action(filename)
+ else if (new File(filename + ".scala").exists)
+ action(filename + ".scala")
+ else {
out.println("That file does not exist")
- return ()
}
- action(filename)
}
val helpRegexp = ":h(e(l(p)?)?)?"