From 1b814fcb8a0479cb9d5710cbee6d19f455c0a435 Mon Sep 17 00:00:00 2001 From: Michele Guerini Rocco Date: Thu, 23 Nov 2023 18:51:47 +0100 Subject: [PATCH] src/main.f90: fix chdir to absolute output path --- src/main.f90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.f90 b/src/main.f90 index af9e3dc..c4f9730 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -80,9 +80,12 @@ program main call init_misc(params, data) + ! Get back to the initial directory + err = chdir(cwd) + ! Change the current directory to output files there if (allocated(opts%output_dir)) then - if (chdir(trim(cwd) // '/' // opts%output_dir) /= 0) then + if (chdir(opts%output_dir) /= 0) then call log_message(level=ERROR, mod='main', & msg='chdir to output_dir ('//opts%output_dir//') failed!') call exit(1)