From 5255239f077b31a963e3fffd39340802dcc75e56 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Thu, 8 Mar 2018 12:42:51 +0000 Subject: [PATCH] Fix Windows error in OpamSystem.resolve_command Returns the directory found, instead of the complete command. Signed-off-by: David Allsopp --- src/core/opamSystem.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/opamSystem.ml b/src/core/opamSystem.ml index 80dd4a887c0..7f1b5d98098 100644 --- a/src/core/opamSystem.ml +++ b/src/core/opamSystem.ml @@ -317,6 +317,7 @@ let env_var env var = makes unqualified commands absolute as a workaround. *) let resolve_command = let is_external_cmd name = + let name = forward_to_back name in OpamStd.String.contains_char name Filename.dir_sep.[0] in let check_perms = @@ -349,9 +350,9 @@ let resolve_command = let name = if Filename.check_suffix name ".exe" then name else name ^ ".exe" in - OpamStd.List.find_opt (fun path -> + OpamStd.(List.find_opt (fun path -> check_perms (Filename.concat path name)) - path + path |> Option.map (fun path -> Filename.concat path name)) else let cmd, args = "/bin/sh", ["-c"; Printf.sprintf "command -v %s" name] in let r =