From 00859876d5f82e0f0281b658ae118b8d3ba484fa Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 18 Mar 2024 17:53:22 +0100 Subject: [PATCH] Fixed read/write in qp_edit --- scripts/ezfio_interface/qp_edit_template | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/ezfio_interface/qp_edit_template b/scripts/ezfio_interface/qp_edit_template index 65c77384..2380660e 100644 --- a/scripts/ezfio_interface/qp_edit_template +++ b/scripts/ezfio_interface/qp_edit_template @@ -156,10 +156,10 @@ let create_temp_file ?filename ezfio_filename fields = let run check_only ?ndet ?state ?read ?write ezfio_filename = (* Set check_only if the arguments are not empty *) - let check_only = - match ndet, state, read with - | None, None, None -> check_only - | _ -> true + let open_editor = + match ndet, state, read, write with + | None, None, None, None -> not check_only + | _ -> false in (* Open EZFIO *) @@ -246,10 +246,7 @@ let run check_only ?ndet ?state ?read ?write ezfio_filename = in - let () = - match check_only with - | true -> () - | false -> + if open_editor then begin (* Open the temp file with external editor *) let editor = @@ -258,8 +255,7 @@ let run check_only ?ndet ?state ?read ?write ezfio_filename = in Printf.sprintf "%s %s" editor temp_filename |> Sys.command |> ignore - end - in + end; if write = None then (* Re-read the temp file *)