summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2007-03-07 21:43:33 +0000
committerLex Spoon <lex@lexspoon.org>2007-03-07 21:43:33 +0000
commite69db0d97f3289cb8a8211b4b411231a3ee73370 (patch)
tree48dabe8c0512d7c7437b9c54e6cf5c9dda2b22d5
parent687e65fb3c45ba90a6ce00d59b84c54918ea89cd (diff)
downloadscala-e69db0d97f3289cb8a8211b4b411231a3ee73370.tar.gz
scala-e69db0d97f3289cb8a8211b4b411231a3ee73370.tar.bz2
scala-e69db0d97f3289cb8a8211b4b411231a3ee73370.zip
Use the same temporary directory for redicted
output as for the port files.
-rw-r--r--src/compiler/scala/tools/nsc/CompileServer.scala6
-rw-r--r--src/compiler/scala/tools/nsc/CompileSocket.scala18
2 files changed, 16 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala
index 198d473795..4e4f37ee0c 100644
--- a/src/compiler/scala/tools/nsc/CompileServer.scala
+++ b/src/compiler/scala/tools/nsc/CompileServer.scala
@@ -152,12 +152,16 @@ object CompileServer extends SocketServer {
}
}
+ /** A directory holding redirected output */
+ val redirectDir = new File(CompileSocket.tmpDir, "output-redirects")
+ redirectDir.mkdirs
+
def redirect(setter: PrintStream => unit, filename: String): unit =
setter(
new PrintStream(
new BufferedOutputStream(
new FileOutputStream(
- new File(System.getProperty("java.io.tmpdir"), filename)))))
+ new File(redirectDir, filename)))))
def main(args: Array[String]): unit = {
redirect(System.setOut, "scala-compile-server-out.log")
diff --git a/src/compiler/scala/tools/nsc/CompileSocket.scala b/src/compiler/scala/tools/nsc/CompileSocket.scala
index 0f9147de8a..d71347631f 100644
--- a/src/compiler/scala/tools/nsc/CompileSocket.scala
+++ b/src/compiler/scala/tools/nsc/CompileSocket.scala
@@ -52,8 +52,8 @@ object CompileSocket {
private def info(msg: String) =
if (CompileClient.verbose) System.out.println(msg)
- /** The temporary directory in which the port identification file is stored */
- private val tmpDir = {
+ /** A temporary directory to use */
+ val tmpDir = {
val totry = List(
("scala.home", List("var", "scala-devel")),
("user.home", List("tmp")),
@@ -87,15 +87,19 @@ object CompileSocket {
yield expanded.get
if (potentials.isEmpty)
- fatal("Could not find a directory for port files")
+ fatal("Could not find a directory for temporary files")
else {
- val d = new File(potentials.head, dirName)
- info("[Temp directory: " + d + "]")
+ val d = potentials.head
d.mkdirs
+ info("[Temp directory: " + d + "]")
d
}
}
+ /* A directory holding port identification files */
+ val portsDir = new File(tmpDir, dirName)
+ portsDir.mkdirs
+
/** Maximum number of polls for an available port */
private val MaxAttempts = 100
@@ -126,11 +130,11 @@ object CompileSocket {
}
/** The port identification file */
- def portFile(port: int) = new File(tmpDir, port.toString())
+ def portFile(port: int) = new File(portsDir, port.toString())
/** Poll for a server port number; return -1 if none exists yet */
private def pollPort(): int = {
- val hits = tmpDir.listFiles()
+ val hits = portsDir.listFiles()
if (hits.length == 0) -1
else
try {