From bc5ef919c02ba95163f093e624dadbc17ae1bbdf Mon Sep 17 00:00:00 2001 From: Geoffrey Washburn Date: Tue, 8 Jul 2008 07:57:42 +0000 Subject: 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. --- src/compiler/scala/tools/nsc/InterpreterLoop.scala | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/compiler') 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)?)?)?" -- cgit v1.2.3