diff options
author | michelou <michelou@epfl.ch> | 2006-07-18 14:00:49 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2006-07-18 14:00:49 +0000 |
commit | 068aa4e25a560da99f20b5f91f357fef8f90e8b8 (patch) | |
tree | bf0b987237f19ff95d04d385ef647dc90e7c8960 /src | |
parent | ccbd600259631c689224cdc206d94db59c8d8967 (diff) | |
download | scala-068aa4e25a560da99f20b5f91f357fef8f90e8b8.tar.gz scala-068aa4e25a560da99f20b5f91f357fef8f90e8b8.tar.bz2 scala-068aa4e25a560da99f20b5f91f357fef8f90e8b8.zip |
fixed (quick fix) handling of arguments in nsc/...
fixed (quick fix) handling of arguments in nsc/CompilerCommand.scala
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/CompileSocket.scala | 30 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/CompilerCommand.scala | 2 |
2 files changed, 7 insertions, 25 deletions
diff --git a/src/compiler/scala/tools/nsc/CompileSocket.scala b/src/compiler/scala/tools/nsc/CompileSocket.scala index e2eae11ff9..bd2cc9824f 100644 --- a/src/compiler/scala/tools/nsc/CompileSocket.scala +++ b/src/compiler/scala/tools/nsc/CompileSocket.scala @@ -49,40 +49,20 @@ object CompileSocket { Some(fulldir) } - /** Write a test file to a directory to see if it is writable */ - def dirWritable(dir: File): Boolean = { - dir.mkdirs - if(!dir.exists) - return false - - val f = new File(dir, "caniwrite") - - try { - f.createNewFile - if(!f.canWrite) - return false - f.delete - if(f.exists) - return false - } catch { - case _:java.io.IOException => - f.delete - return false - } - - return true - } + /** Test if file f is a writable directory */ + def isDirWritable(f: File): Boolean = + f.isDirectory && f.canWrite val potentials = for { val trial <- totry val expanded = expand(trial) !expanded.isEmpty - dirWritable(expanded.get) + isDirWritable(expanded.get) } yield expanded.get - if(potentials.isEmpty) { + if (potentials.isEmpty) { Console.println("could not find a directory for port files") exit(1) } else { diff --git a/src/compiler/scala/tools/nsc/CompilerCommand.scala b/src/compiler/scala/tools/nsc/CompilerCommand.scala index 782a6a9338..02a7d7496d 100644 --- a/src/compiler/scala/tools/nsc/CompilerCommand.scala +++ b/src/compiler/scala/tools/nsc/CompilerCommand.scala @@ -67,6 +67,8 @@ class CompilerCommand(arguments: List[String], error: String => unit, interactiv } else if (settings.Xscript.value || args.head.endsWith(fileEnding)) { fs = args.head :: fs args = args.tail + } else if (args.head.length == 0) {//quick fix + args = args.tail } else { error("don't know what to do with " + args.head) ok = false |