summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-08-31 20:19:46 +0000
committerPaul Phillips <paulp@improving.org>2009-08-31 20:19:46 +0000
commitd9a7d026ce8d48c9bf9d8eb669a3a9430105120e (patch)
treea77ec5f73530c8370c99a0f0b8b1eac0c042b951
parentc918b70784d41b0aa7efe5eea74e5ec7a4224421 (diff)
downloadscala-d9a7d026ce8d48c9bf9d8eb669a3a9430105120e.tar.gz
scala-d9a7d026ce8d48c9bf9d8eb669a3a9430105120e.tar.bz2
scala-d9a7d026ce8d48c9bf9d8eb669a3a9430105120e.zip
One more try to unbreak fsc all the way.
-rw-r--r--src/compiler/scala/tools/nsc/CompileServer.scala2
-rw-r--r--src/compiler/scala/tools/nsc/CompileSocket.scala1
-rw-r--r--src/compiler/scala/tools/nsc/io/PlainFile.scala2
-rw-r--r--src/library/scala/io/Path.scala4
-rw-r--r--src/library/scala/xml/persistent/CachedFileStorage.scala2
5 files changed, 8 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala
index 37f57bb862..4e037201a4 100644
--- a/src/compiler/scala/tools/nsc/CompileServer.scala
+++ b/src/compiler/scala/tools/nsc/CompileServer.scala
@@ -145,7 +145,7 @@ class StandardCompileServer extends SocketServer
private val redirectDir = (compileSocket.tmpDir / "output-redirects").ensureDirectory()
private def redirect(setter: PrintStream => Unit, filename: String): Unit =
- setter(new PrintStream((redirectDir / filename).createFile.bufferedOutput()))
+ setter(new PrintStream((redirectDir / filename).ensureFile.bufferedOutput()))
def main(args: Array[String]) {
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 9b31cfe846..d65485d998 100644
--- a/src/compiler/scala/tools/nsc/CompileSocket.scala
+++ b/src/compiler/scala/tools/nsc/CompileSocket.scala
@@ -121,6 +121,7 @@ class CompileSocket {
if (port < 0)
startNewServer(vmArgs)
+
while (port < 0 && attempts < MaxAttempts) {
attempts += 1
Thread.sleep(sleepTime)
diff --git a/src/compiler/scala/tools/nsc/io/PlainFile.scala b/src/compiler/scala/tools/nsc/io/PlainFile.scala
index 7e5e8576b1..359f062f41 100644
--- a/src/compiler/scala/tools/nsc/io/PlainFile.scala
+++ b/src/compiler/scala/tools/nsc/io/PlainFile.scala
@@ -77,7 +77,7 @@ class PlainFile(val givenPath: Path) extends AbstractFile {
}
/** Does this abstract file denote an existing file? */
- def create: Unit = if (!exists) givenPath.createFile()
+ def create: Unit = if (!exists) givenPath.ensureFile()
/** Delete the underlying file or directory (recursively). */
def delete: Unit =
diff --git a/src/library/scala/io/Path.scala b/src/library/scala/io/Path.scala
index 043cb3e66b..3d2bfaeca5 100644
--- a/src/library/scala/io/Path.scala
+++ b/src/library/scala/io/Path.scala
@@ -151,6 +151,10 @@ class Path private[io] (val jfile: JFile)
def ensureDirectory(force: Boolean = true): Directory =
if (this.isDirectory) this.toDirectory else createDirectory(force)
+ /** This is temporary while I try to unbreak fsc. */
+ def ensureFile(): File =
+ if (this.isFile) this.toFile else createFile()
+
// deletions
def delete() = jfile.delete()
def deleteIfExists() = if (jfile.exists()) delete() else false
diff --git a/src/library/scala/xml/persistent/CachedFileStorage.scala b/src/library/scala/xml/persistent/CachedFileStorage.scala
index 17194b4421..8b3907b7f5 100644
--- a/src/library/scala/xml/persistent/CachedFileStorage.scala
+++ b/src/library/scala/xml/persistent/CachedFileStorage.scala
@@ -81,7 +81,7 @@ extends java.lang.Thread with scala.util.logging.Logged
log("[save]\ndeleting "+theFile);
theFile.delete();
log("creating new "+theFile);
- theFile.createFile();
+ theFile.ensureFile();
val fos = theFile.outputStream()
val c = fos.getChannel()