Skip to content

Commit

Permalink
Windows: Replace system calls with equivalent Fortran/C calls
Browse files Browse the repository at this point in the history
Fix intermittent failure of `system` commands on Windows: occasionally the system calls would fail to finish and make the program hang or end prematurely without any error message.
  • Loading branch information
bjonkman committed Jan 12, 2024
1 parent 4a2a697 commit d120344
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/nwtc-library/src/SysIVF.f90
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,18 @@ END SUBROUTINE Get_CWD
!> This routine creates a given directory if it does not already exist.
SUBROUTINE MKDIR ( new_directory_path )

USE IFPORT, ONLY: MAKEDIRQQ
implicit none

character(*), intent(in) :: new_directory_path
character(1024) :: make_command
logical :: directory_exists
logical :: success

! Check if the directory exists first
inquire( directory=trim(new_directory_path), exist=directory_exists )

if ( .NOT. directory_exists ) then
make_command = 'mkdir "'//trim(new_directory_path)//'"'
call system( make_command )
success = MAKEDIRQQ( trim(new_directory_path) )
endif

END SUBROUTINE MKDIR
Expand Down

0 comments on commit d120344

Please sign in to comment.