diff options
author | Laurence Kedward <laurence.kedward@bristol.ac.uk> | 2021-11-22 16:08:27 +0000 |
---|---|---|
committer | Laurence Kedward <laurence.kedward@bristol.ac.uk> | 2021-11-22 16:08:27 +0000 |
commit | d9520ce7ca433c94d4309ee834c0d4494652c4d0 (patch) | |
tree | 4e352ae4667c8f5bffad29627158a775b3820469 | |
parent | 22ec97aceb5239f2b24e58ab05f41e6e9e4abf35 (diff) | |
download | fpm-d9520ce7ca433c94d4309ee834c0d4494652c4d0.tar.gz fpm-d9520ce7ca433c94d4309ee834c0d4494652c4d0.zip |
Update: mkdir with optional echo argument
-rw-r--r-- | src/fpm_filesystem.F90 | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/fpm_filesystem.F90 b/src/fpm_filesystem.F90 index 83cffe7..2b5b787 100644 --- a/src/fpm_filesystem.F90 +++ b/src/fpm_filesystem.F90 @@ -349,20 +349,36 @@ function read_lines(fh) result(lines) end function read_lines !> Create a directory. Create subdirectories as needed -subroutine mkdir(dir) +subroutine mkdir(dir, echo) character(len=*), intent(in) :: dir - integer :: stat + logical, intent(in), optional :: echo + + integer :: stat + logical :: echo_local + + if(present(echo))then + echo_local=echo + else + echo_local=.true. + end if if (is_dir(dir)) return select case (get_os_type()) case (OS_UNKNOWN, OS_LINUX, OS_MACOS, OS_CYGWIN, OS_SOLARIS, OS_FREEBSD, OS_OPENBSD) call execute_command_line('mkdir -p ' // dir, exitstat=stat) - write (*, '(" + ",2a)') 'mkdir -p ' // dir + + if (echo_local) then + write (*, '(" + ",2a)') 'mkdir -p ' // dir + end if case (OS_WINDOWS) call execute_command_line("mkdir " // windows_path(dir), exitstat=stat) - write (*, '(" + ",2a)') 'mkdir ' // windows_path(dir) + + if (echo_local) then + write (*, '(" + ",2a)') 'mkdir ' // windows_path(dir) + end if + end select if (stat /= 0) then |