Skip to content

Commit

Permalink
Merge pull request #542 from Slesa/develop
Browse files Browse the repository at this point in the history
Issue #541: look first in default path for a tool
  • Loading branch information
forki committed Sep 19, 2014
2 parents ddc9ac1 + 4e3a373 commit 92a17bc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/app/FakeLib/Globbing/FileSystem.fs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,14 @@ let inline (!!) x = Include x
[<Obsolete("!+ is obsolete - use !! instead")>]
let inline (!+) x = Include x

/// Looks for a tool in all subfolders - returns the tool file name.
/// Looks for a tool first in its default path, if not found in all subfolders of the root folder - returns the tool file name.
let findToolInSubPath toolname defaultPath =
let tools = !! ("./**/" @@ toolname)
if Seq.isEmpty tools then defaultPath @@ toolname
else Seq.head tools
let tools = !! (defaultPath @@ "/**/" @@ toolname)
if Seq.isEmpty tools then
let root = !! ("./**/" @@ toolname)
Seq.head root
else
Seq.head tools

/// Looks for a tool in all subfolders - returns the folder where the tool was found.
let findToolFolderInSubPath toolname defaultPath =
Expand Down

0 comments on commit 92a17bc

Please sign in to comment.