src/main.f90: fix chdir to absolute output path

This commit is contained in:
Michele Guerini Rocco 2023-11-23 18:51:47 +01:00
parent 621c725948
commit 1b814fcb8a
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450

View File

@ -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)