Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #541: look first in default path for a tool #542

Merged
merged 1 commit into from
Sep 19, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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