From 35a083f6f3c8daa60c7b1bd975812b5a92c0ddbd Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 31 Jul 2019 15:07:04 +0200 Subject: [PATCH] Bugfix --- ocaml/Block.ml | 3 +++ ocaml/QmcMd5.ml | 2 +- ocaml/Qmcchem_dataserver.ml | 2 +- ocaml/Qputils.ml | 12 ------------ ocaml/Random_variable.ml | 8 ++++++-- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/ocaml/Block.ml b/ocaml/Block.ml index 6de510b..36cb482 100644 --- a/ocaml/Block.ml +++ b/ocaml/Block.ml @@ -69,6 +69,9 @@ let dir_name = lazy( let md5 = QmcMd5.hash () in + let d = Filename.concat ezfio_filename "blocks" in + if not ( Sys.file_exists d ) then + Unix.mkdir d 0o755; List.fold_right Filename.concat [ ezfio_filename ; "blocks" ; md5 ; Filename.dir_sep ] "" ) diff --git a/ocaml/QmcMd5.ml b/ocaml/QmcMd5.ml index 33dbf19..ee09049 100644 --- a/ocaml/QmcMd5.ml +++ b/ocaml/QmcMd5.ml @@ -10,7 +10,7 @@ let input_directory = lazy ( in begin - if not (Sys.file_exists dirname && Sys.is_directory dirname) then + if not (Sys.file_exists dirname) then Unix.mkdir dirname 0o777 end ; diff --git a/ocaml/Qmcchem_dataserver.ml b/ocaml/Qmcchem_dataserver.ml index 90199c2..6242529 100644 --- a/ocaml/Qmcchem_dataserver.ml +++ b/ocaml/Qmcchem_dataserver.ml @@ -347,7 +347,7 @@ let run ?(daemon=true) ezfio_filename = Lazy.force Block.dir_name in let () = - if not ( Sys.file_exists dirname && Sys.is_directory dirname ) then + if not ( Sys.file_exists dirname ) then Unix.mkdir dirname 0o755 in Filename.concat dirname ( diff --git a/ocaml/Qputils.ml b/ocaml/Qputils.ml index 199ceab..2657047 100644 --- a/ocaml/Qputils.ml +++ b/ocaml/Qputils.ml @@ -46,18 +46,6 @@ let ezfio_filename = lazy ( in set_ezfio_filename full_path; - (* - (* Check if input directory is present *) - let dirname = Filename.concat full_path "input" in - if not (Sys.file_exists dirname) then - Unix.mkdir dirname 0o755; - - (* Check if blocks directory is present *) - let dirname = Filename.concat full_path "blocks" in - if not (Sys.file_exists dirname) then - Unix.mkdir dirname 0o755; - *) - !Ezfio.ezfio_filename ) diff --git a/ocaml/Random_variable.ml b/ocaml/Random_variable.ml index 0eeab92..fb0985a 100644 --- a/ocaml/Random_variable.ml +++ b/ocaml/Random_variable.ml @@ -680,9 +680,13 @@ let compress_files () = let out_channel_dir = let rand_num = Random.int 1000000 |> string_of_int in + let dirname = + Filename.concat !Ezfio.ezfio_filename "blocks" + in + if not ( Sys.file_exists dirname ) then + Unix.mkdir dirname 0o755; let tmp_dir = - Filename.concat !Ezfio.ezfio_filename @@ - Filename.concat "blocks" "qmc"^rand_num + Filename.concat dirname ("qmc"^rand_num) in try Unix.mkdir tmp_dir 0o755;