From 068aa4e25a560da99f20b5f91f357fef8f90e8b8 Mon Sep 17 00:00:00 2001 From: michelou Date: Tue, 18 Jul 2006 14:00:49 +0000 Subject: fixed (quick fix) handling of arguments in nsc/... fixed (quick fix) handling of arguments in nsc/CompilerCommand.scala --- src/compiler/scala/tools/nsc/CompileSocket.scala | 30 ++++-------------------- 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'src/compiler/scala/tools/nsc/CompileSocket.scala') 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 { -- cgit v1.2.3