From b0fa735311f4f6d761addc57fda5629d799cc6e3 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 23 Jul 2019 17:39:51 +0200 Subject: [PATCH] Fixing small bugs --- ocaml/Qmcchem_dataserver.ml | 5 ++++- ocaml/Random_variable.ml | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ocaml/Qmcchem_dataserver.ml b/ocaml/Qmcchem_dataserver.ml index 11d965b..90199c2 100644 --- a/ocaml/Qmcchem_dataserver.ml +++ b/ocaml/Qmcchem_dataserver.ml @@ -392,7 +392,10 @@ let run ?(daemon=true) ezfio_filename = Unix.rename block_channel_filename_locked block_channel_filename_tmp; Random_variable.compress_files (); send_log "status" 0 t0 "Compressed block file"; - block_channel := open_out_gen [ Open_append ] 0o660 block_channel_filename_locked + if Sys.file_exists block_channel_filename_locked then + block_channel := open_out_gen [ Open_append ] 0o660 block_channel_filename_locked + else + block_channel := open_out block_channel_filename_locked in diff --git a/ocaml/Random_variable.ml b/ocaml/Random_variable.ml index 14351c8..0eeab92 100644 --- a/ocaml/Random_variable.ml +++ b/ocaml/Random_variable.ml @@ -681,14 +681,15 @@ let compress_files () = let out_channel_dir = let rand_num = Random.int 1000000 |> string_of_int in let tmp_dir = - Filename.concat "!Ezfio.ezfio_filename" @@ - Filename.concat "blocks" @@ - Filename.concat "qmc" rand_num + Filename.concat !Ezfio.ezfio_filename @@ + Filename.concat "blocks" "qmc"^rand_num in try Unix.mkdir tmp_dir 0o755; tmp_dir - with _ -> raise (Sys_error "Cannot create temp dir") + with _ -> + let message = Printf.sprintf "Cannot create temp dir %s" tmp_dir in + raise (Sys_error message) in let out_channel_name =