diff options
author | Paul Phillips <paulp@improving.org> | 2009-02-27 17:34:13 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-02-27 17:34:13 +0000 |
commit | 174a9a70594963a6f84917d81d85bf1954c05fdc (patch) | |
tree | e5b85ed0c5abf48b623103ddaffb33870934cce0 /src | |
parent | 07ee2ba75f22244b5d07fb54365f00b5e0d6f796 (diff) | |
download | scala-174a9a70594963a6f84917d81d85bf1954c05fdc.tar.gz scala-174a9a70594963a6f84917d81d85bf1954c05fdc.tar.bz2 scala-174a9a70594963a6f84917d81d85bf1954c05fdc.zip |
Fix for #1743.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/CompileSocket.scala | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/compiler/scala/tools/nsc/CompileSocket.scala b/src/compiler/scala/tools/nsc/CompileSocket.scala index 72b8a4a71e..f5fe702e7a 100644 --- a/src/compiler/scala/tools/nsc/CompileSocket.scala +++ b/src/compiler/scala/tools/nsc/CompileSocket.scala @@ -60,8 +60,8 @@ class CompileSocket { val tmpDir = { val totry = List( ("scala.home", List("var", "scala-devel")), - ("user.home", List("tmp")), - ("java.io.tmpdir", Nil)) + ("java.io.tmpdir", List("scala-devel")), + ("user.home", List("tmp"))) /** Expand a property-extensions pair into a complete File object */ def expand(trial: (String, List[String])): Option[File] = { @@ -84,23 +84,17 @@ class CompileSocket { f.isDirectory && f.canWrite } - val potentials = - for { - trial <- totry - val expanded = expand(trial) - if !expanded.isEmpty - if isDirWritable(expanded.get) + def findTmpDir(): File = { + for (trial <- totry) expand(trial) match { + case Some(dir) if isDirWritable(dir) => + info("[Temp directory: " + dir + "]") + return dir + case _ => } - yield expanded.get - - if (potentials.isEmpty) fatal("Could not find a directory for temporary files") - else { - val d = potentials.head - d.mkdirs - info("[Temp directory: " + d + "]") - d } + + findTmpDir() } /* A directory holding port identification files */ |