Skip to content

Commit a3c3453

Browse files
authored
fix #399 (#400)
1 parent d84bacc commit a3c3453

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/analyze/Packages.re

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,33 @@ let newBsPackage = (~overrideBuildSystem=?, ~reportDiagnostics, state, rootPath)
5050

5151
let%try bsPlatform = BuildSystem.getBsPlatformDir(rootPath);
5252

53+
54+
let nodePlatform =
55+
switch (Sys.os_type) {
56+
| "Unix" => switch (input_line (Unix.open_process_in ("uname -s"))) {
57+
| "Darwin" => "darwin"
58+
| "Linux" => "linux"
59+
| "FreeBSD" => "freebsd"
60+
| s => invalid_arg (s ++ ": unsupported os_type")
61+
}
62+
| "Win32" => "win32"
63+
| s => invalid_arg (s ++ ": unsupported os_type")
64+
};
65+
66+
let bsb = switch (Files.ifExists(bsPlatform /+ "lib" /+ "bsb.exe")){
67+
| Some (x) => x
68+
| None =>
69+
switch (Files.ifExists(bsPlatform /+ nodePlatform /+ "bsb.exe")){
70+
| Some (x) => x
71+
| None => failwith ("can not locate bsb.exe in " ++ bsPlatform)
72+
}
73+
};
74+
5375
let%try buildSystem = switch overrideBuildSystem {
5476
| None => BuildSystem.detect(rootPath, config)
5577
| Some(s) => Ok(s)
5678
};
5779

58-
let%try bsb = Files.ifExists(bsPlatform /+ "lib" /+ "bsb.exe") |> RResult.orError(bsPlatform /+ "lib" /+ "bsb.exe not found. aborting");
5980

6081
let buildCommand = switch buildSystem {
6182
| Bsb(_) => bsb ++ " -make-world"

0 commit comments

Comments
 (0)