summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 {