From 411f6964f7d62de6c2b45dfb2400f76686447cd7 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Fri, 11 Nov 2022 13:44:11 +0100 Subject: Add a `bin` folder --- compiler/Translate.ml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'compiler/Translate.ml') diff --git a/compiler/Translate.ml b/compiler/Translate.ml index c4185f41..959ea5ac 100644 --- a/compiler/Translate.ml +++ b/compiler/Translate.ml @@ -658,12 +658,14 @@ let translate_module (filename : string) (dest_dir : string) (crate : A.crate) : (* Create a directory with *default* permissions *) Core_unix.mkdir_p dest_dir); - (* Copy "Primitives.fst" - I couldn't find a "cp" function in the OCaml - * libraries... *) + (* Copy "Primitives.fst" *) let _ = - let src = open_in "fstar/Primitives.fst" in + (* Retrieve the executable's directory *) + let exe_dir = Filename.dirname Sys.argv.(0) in + let src = open_in (exe_dir ^ "/fstar/Primitives.fst") in let tgt_filename = Filename.concat dest_dir "Primitives.fst" in let tgt = open_out tgt_filename in + (* Very annoying: I couldn't find a "cp" function in the OCaml libraries... *) try while true do (* We copy line by line *) -- cgit v1.2.3