summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-05-07 02:51:58 +0000
committerPaul Phillips <paulp@improving.org>2011-05-07 02:51:58 +0000
commit4cd3e354cec56e3f34efbbca0c6a3cfc188869d1 (patch)
tree2fdefcd8a6a682b43433fbe60551c30c7cc08a41
parent7a29a1ca3b88030cdf175e3bfa5054516ed7d03a (diff)
downloadscala-4cd3e354cec56e3f34efbbca0c6a3cfc188869d1.tar.gz
scala-4cd3e354cec56e3f34efbbca0c6a3cfc188869d1.tar.bz2
scala-4cd3e354cec56e3f34efbbca0c6a3cfc188869d1.zip
My estimation of what will fix fsc on cygwin/wi...
My estimation of what will fix fsc on cygwin/windows, but untested. Review by community.
-rw-r--r--src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala b/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala
index ad45651e23..6d6b99e53e 100644
--- a/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala
+++ b/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala
@@ -7,6 +7,7 @@ package scala.tools.nsc
import settings.FscSettings
import io.Directory
+import Properties.isWin
/** A compiler command for the offline compiler.
*
@@ -21,9 +22,12 @@ class OfflineCompilerCommand(arguments: List[String], settings: FscSettings) ext
if (currentDir.isDefault) {
// Prefer env variable PWD to system property user.dir because the former
// deals better with paths not rooted at / (filesystem mounts.)
- val baseDirectory = System.getenv("PWD") match {
- case null => Directory.Current getOrElse Directory("/")
- case dir => Directory(dir)
+ // ... except on windows, because under cygwin PWD involves "/cygdrive"
+ // instead of whatever it's supposed to be doing.
+ val baseDirectory = {
+ val pwd = System.getenv("PWD")
+ if (pwd != null && !isWin) Directory(pwd)
+ else Directory.Current getOrElse Directory("/")
}
currentDir.value = baseDirectory.path
}