diff --git a/src/analyze/BuildSystem.re b/src/analyze/BuildSystem.re index e11fe52b..628ea5e2 100644 --- a/src/analyze/BuildSystem.re +++ b/src/analyze/BuildSystem.re @@ -264,10 +264,24 @@ let isRunningInEsyNamedSandbox = () => { }; let getExecutableInEsyPath = (exeName, ~pwd) => { - if (isRunningInEsyNamedSandbox()) { + let ret = if (isRunningInEsyNamedSandbox()) { getLine("which " ++ exeName, ~pwd) } else { getLine("esy which " ++ exeName, ~pwd) + }; + if (Sys.win32) { + switch ret { + | RResult.Ok(ret) => + let ret = if (isRunningInEsyNamedSandbox()) { + getLine("cygpath -w " ++ ret, ~pwd) + } else { + getLine("esy cygpath -w " ++ ret, ~pwd) + }; + ret + | Error(a) => Error(a) + } + } else { + ret } }; diff --git a/src/analyze/Packages.re b/src/analyze/Packages.re index ae2546ad..aec063a1 100644 --- a/src/analyze/Packages.re +++ b/src/analyze/Packages.re @@ -362,7 +362,9 @@ let newJbuilderPackage = (~overrideBuildSystem=?, ~reportDiagnostics, state, roo /* Log.log("Getting things"); */ - let (otherDirectories, otherFiles) = source |> List.filter(s => s != "." && s != "" && s.[0] != '/') |> optMap(name => { + let (globalSource, localSource) = List.filter(s => s != "." && s != "", source) + |> List.partition(Infix.isFullPath); + let (otherDirectories, otherFiles) = localSource |> optMap(name => { let otherPath = rootPath /+ name; let res = { let%try (jbuildPath, jbuildRaw) = JbuildFile.readFromDir(otherPath); @@ -395,7 +397,7 @@ let newJbuilderPackage = (~overrideBuildSystem=?, ~reportDiagnostics, state, roo } }) |> List.split; - let dependencyDirectories = (source |> List.filter(s => s != "" && s != "." && s.[0] == '/')) @ stdlibs; + let dependencyDirectories = globalSource @ stdlibs; let dependencyModules = dependencyDirectories |> List.map(path => { diff --git a/util/Files.re b/util/Files.re index 9ed24efd..f712d6f2 100644 --- a/util/Files.re +++ b/util/Files.re @@ -4,7 +4,7 @@ let split = (str, string) => Str.split(Str.regexp_string(str), string); let absify = path => { if (path == "" || path == ".") { Unix.getcwd() - } else if (path.[0] == '/') { + } else if (Infix.isFullPath(path)) { path } else { Filename.concat(Unix.getcwd(), path) diff --git a/util/Infix.re b/util/Infix.re index 14e64d8b..4f737f02 100644 --- a/util/Infix.re +++ b/util/Infix.re @@ -33,8 +33,10 @@ let logIfAbsent = (message, x) => switch x { | _ => x }; +let isFullPath = b => b.[0] == '/' || Sys.win32 && String.length(b) > 1 && b.[1] == ':'; + let maybeConcat = (a, b) => { - if (b != "" && b.[0] == '/') { + if (b != "" && isFullPath(b)) { b } else { fileConcat(a, b) diff --git a/util/MerlinFile.re b/util/MerlinFile.re index dd815981..2e8535d6 100644 --- a/util/MerlinFile.re +++ b/util/MerlinFile.re @@ -33,10 +33,10 @@ let parseMerlin = (base, text) => { ) }; -// let maybeConcat = (base, path) => path.[0] == '/' ? path : Filename.concat(base, path); +// let maybeConcat = (base, path) => Infix.isFullPath(path) ? path : Filename.concat(base, path); -let isRelativePath = Sys.os_type == "Win32" -? path => !Str.string_match(Str.regexp("[A-Z]:"), path, 0) +let isRelativePath = Sys.win32 +? path => !Str.string_match(Str.regexp("[A-Za-z]:"), path, 0) : path => path != "" && path.[0] != '/'; let isBuildFile = name =>