diff options
author | Paul Phillips <paulp@improving.org> | 2011-07-09 22:52:53 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-07-09 22:52:53 +0000 |
commit | 7d4cff1dc6040d951b09f8df4af288d16ef53de2 (patch) | |
tree | 58b1b24ca12011ec53004aa675ecd2fbacfc501f /src/compiler/scala/tools/nsc/io/Path.scala | |
parent | f0169872c9453ab6c50c008b8426d3bca7d1c178 (diff) | |
download | scala-7d4cff1dc6040d951b09f8df4af288d16ef53de2.tar.gz scala-7d4cff1dc6040d951b09f8df4af288d16ef53de2.tar.bz2 scala-7d4cff1dc6040d951b09f8df4af288d16ef53de2.zip |
Moved a warning behind -Xlint.
meant for --grep to look in checkfiles too, and now it does. No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/io/Path.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/io/Path.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/io/Path.scala b/src/compiler/scala/tools/nsc/io/Path.scala index ebc568cfe6..9efff089ba 100644 --- a/src/compiler/scala/tools/nsc/io/Path.scala +++ b/src/compiler/scala/tools/nsc/io/Path.scala @@ -194,8 +194,12 @@ class Path private[io] (val jfile: JFile) { def stripExtension: String = name stripSuffix ("." + extension) // returns the Path with the extension. def addExtension(ext: String): Path = Path(path + "." + ext) - // changes the existing extension out for a new one - def changeExtension(ext: String): Path = Path(path stripSuffix extension) addExtension ext + // changes the existing extension out for a new one, or adds it + // if the current path has none. + def changeExtension(ext: String): Path = ( + if (extension == "") addExtension(ext) + else Path(path.stripSuffix(extension) + ext) + ) // conditionally execute def ifFile[T](f: File => T): Option[T] = if (isFile) Some(f(toFile)) else None |