diff options
author | James Iry <jamesiry@gmail.com> | 2013-01-28 11:58:11 -0800 |
---|---|---|
committer | James Iry <jamesiry@gmail.com> | 2013-01-28 11:58:11 -0800 |
commit | cc3b9a23ebb453b827197e5ab5cba46a9e770f0c (patch) | |
tree | f0e762360754b67981664b563f4b1f56e0785d03 /src | |
parent | d4de6f4cc6c3f0f9d7810c6e9a10147a0406e3f5 (diff) | |
parent | 3cbb0029e98304c7bd86b4854086d67f0e06b6b4 (diff) | |
download | scala-cc3b9a23ebb453b827197e5ab5cba46a9e770f0c.tar.gz scala-cc3b9a23ebb453b827197e5ab5cba46a9e770f0c.tar.bz2 scala-cc3b9a23ebb453b827197e5ab5cba46a9e770f0c.zip |
Merge pull request #1973 from JamesIry/SI-4602_2.10.x
SI-4602 Make fsc absolutize source file names
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/settings/FscSettings.scala | 23 |
2 files changed, 18 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala b/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala index 8a3c531ff0..caf6ad14cf 100644 --- a/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala +++ b/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala @@ -33,7 +33,7 @@ class OfflineCompilerCommand(arguments: List[String], settings: FscSettings) ext } else { // Otherwise we're on the server and will use it to absolutize the paths. - settings.absolutize(currentDir.value) + settings.absolutize() } } diff --git a/src/compiler/scala/tools/nsc/settings/FscSettings.scala b/src/compiler/scala/tools/nsc/settings/FscSettings.scala index 06ebc20d3e..5c852ae07c 100644 --- a/src/compiler/scala/tools/nsc/settings/FscSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/FscSettings.scala @@ -38,14 +38,25 @@ class FscSettings(error: String => Unit) extends Settings(error) { private def holdsPath = Set[Settings#Setting]( d, dependencyfile, pluginsDir, Ygenjavap ) + + override def processArguments(arguments: List[String], processAll: Boolean): (Boolean, List[String]) = { + val (r, args) = super.processArguments(arguments, processAll) + // we need to ensure the files specified with relative locations are absolutized based on the currentDir + (r, args map {a => absolutizePath(a)}) + } + + /** + * Take an individual path and if it's not absolute turns it into an absolute path based on currentDir. + * If it's already absolute then it's left alone. + */ + private[this] def absolutizePath(p: String) = (Path(currentDir.value) resolve Path(p)).normalize.path - /** All user set settings rewritten with absolute paths. */ - def absolutize(root: Path) { - def rewrite(p: String) = (root resolve Path(p)).normalize.path + /** All user set settings rewritten with absolute paths based on currentDir */ + def absolutize() { userSetSettings foreach { - case p: OutputSetting => p.outputDirs setSingleOutput AbstractFile.getDirectory(rewrite(p.value)) - case p: PathSetting => p.value = ClassPath.map(p.value, rewrite) - case p: StringSetting => if (holdsPath(p)) p.value = rewrite(p.value) + case p: OutputSetting => p.outputDirs setSingleOutput AbstractFile.getDirectory(absolutizePath(p.value)) + case p: PathSetting => p.value = ClassPath.map(p.value, absolutizePath) + case p: StringSetting => if (holdsPath(p)) p.value = absolutizePath(p.value) case _ => () } } |