From f77c4927bc807831d22187040eff36bf2fb6a0e1 Mon Sep 17 00:00:00 2001 From: Jacek Laskowski Date: Sat, 4 Jan 2014 17:19:41 +0100 Subject: [PATCH 1/2] deprecated says to use pair and so it's used in the body --- util/io/src/main/scala/sbt/Path.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/io/src/main/scala/sbt/Path.scala b/util/io/src/main/scala/sbt/Path.scala index a21e96bd8..3b79e17ae 100644 --- a/util/io/src/main/scala/sbt/Path.scala +++ b/util/io/src/main/scala/sbt/Path.scala @@ -118,7 +118,7 @@ sealed abstract class PathFinder final def \ (literal: String): PathFinder = this / literal @deprecated("Use pair.", "0.13.1") - def x_![T](mapper: File => Option[T]): Traversable[(File,T)] = x(mapper, false) + def x_![T](mapper: File => Option[T]): Traversable[(File,T)] = pair(mapper, false) /** Applies `mapper` to each path selected by this PathFinder and returns the path paired with the non-empty result. * If the result is empty (None) and `errorIfNone` is true, an exception is thrown. From 5c268bd9ea60df958710eb4d46570a5b6b252282 Mon Sep 17 00:00:00 2001 From: Jacek Laskowski Date: Mon, 7 Apr 2014 22:31:40 +0200 Subject: [PATCH 2/2] Follow deprecation - @deprecated says to use pair and so it's used in the body --- util/io/src/main/scala/sbt/Path.scala | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/util/io/src/main/scala/sbt/Path.scala b/util/io/src/main/scala/sbt/Path.scala index 3b79e17ae..10ec194c3 100644 --- a/util/io/src/main/scala/sbt/Path.scala +++ b/util/io/src/main/scala/sbt/Path.scala @@ -124,19 +124,15 @@ sealed abstract class PathFinder * If the result is empty (None) and `errorIfNone` is true, an exception is thrown. * If `errorIfNone` is false, the path is dropped from the returned Traversable.*/ def pair[T](mapper: File => Option[T], errorIfNone: Boolean = true): Seq[(File,T)] = - x(mapper, errorIfNone) + { + val apply = if(errorIfNone) mapper | fail else mapper + for(file <- get; mapped <- apply(file)) yield (file, mapped) + } - /** Applies `mapper` to each path selected by this PathFinder and returns the path paired with the non-empty result. - * If the result is empty (None) and `errorIfNone` is true, an exception is thrown. - * If `errorIfNone` is false, the path is dropped from the returned Traversable.*/ @deprecated("Use pair.", "0.13.1") - def x[T](mapper: File => Option[T], errorIfNone: Boolean = true): Seq[(File,T)] = - { - val apply = if(errorIfNone) mapper | fail else mapper - for(file <- get; mapped <- apply(file)) yield (file, mapped) - } + def x[T](mapper: File => Option[T], errorIfNone: Boolean = true): Seq[(File,T)] = pair(mapper, errorIfNone) - /** Selects all descendant paths with a name that matches include and do not have an intermediate + /** Selects all descendant paths with a name that matches include and do not have an intermediate * path with a name that matches intermediateExclude. Typical usage is: * * descendantsExcept("*.jar", ".svn")*/