Skip to content

Commit

Permalink
correctly report "Mac" system name on OSX in macros (close HaxeFounda…
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse committed May 10, 2014
1 parent 0eee921 commit 3d573d1
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions interp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1637,11 +1637,25 @@ let std_lib =
Unix.chdir (vstring s);
VNull;
);
"sys_string", Fun0 (fun() ->
VString (match Sys.os_type with
| "Unix" -> "Linux"
| "Win32" | "Cygwin" -> "Windows"
| s -> s)
"sys_string", (
let cached_sys_name = ref None in
Fun0 (fun() ->
VString (match Sys.os_type with
| "Unix" ->
(match !cached_sys_name with
| Some n -> n
| None ->
let ic = Unix.open_process_in "uname" in
let uname = (match input_line ic with
| "Darwin" -> "Mac"
| n -> n
) in
close_in ic;
cached_sys_name := Some uname;
uname)
| "Win32" | "Cygwin" -> "Windows"
| s -> s)
)
);
"sys_is64", Fun0 (fun() ->
VBool (Sys.word_size = 64)
Expand Down

0 comments on commit 3d573d1

Please sign in to comment.