summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSon Ho2022-11-11 13:44:11 +0100
committerSon HO2022-11-11 15:26:17 +0100
commit411f6964f7d62de6c2b45dfb2400f76686447cd7 (patch)
tree37bcfa87953df6307306a0299c0f69bc82e5f918 /compiler
parent0b4e739f6be83e0fe9337f6363343587b35c5752 (diff)
Add a `bin` folder
Diffstat (limited to '')
-rw-r--r--compiler/Translate.ml8
1 files changed, 5 insertions, 3 deletions
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 *)