diff options
author | init current directory[i] <urbanjost@comcast.net> | 2020-10-11 06:10:52 -0400 |
---|---|---|
committer | init current directory[i] <urbanjost@comcast.net> | 2020-10-11 06:10:52 -0400 |
commit | 07667934b065ca61a5db38882a1bf8933e96317f (patch) | |
tree | 1d0ca67fe6d15c2437b4ce8a3ff3e975b43fac2b | |
parent | 79214e63fef965eeb03a5c38226aa55ea22315d9 (diff) | |
download | fpm-07667934b065ca61a5db38882a1bf8933e96317f.tar.gz fpm-07667934b065ca61a5db38882a1bf8933e96317f.zip |
check if name is a directory on backfill instead of depending on system command
-rw-r--r-- | fpm/src/fpm/cmd/new.f90 | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fpm/src/fpm/cmd/new.f90 b/fpm/src/fpm/cmd/new.f90 index dce13bc..757274e 100644 --- a/fpm/src/fpm/cmd/new.f90 +++ b/fpm/src/fpm/cmd/new.f90 @@ -2,7 +2,7 @@ module fpm_cmd_new use fpm_command_line, only : fpm_new_settings use fpm_environment, only : run, OS_LINUX, OS_MACOS, OS_WINDOWS -use fpm_filesystem, only : join_path, exists, basename, mkdir +use fpm_filesystem, only : join_path, exists, basename, mkdir, is_dir use,intrinsic :: iso_fortran_env, only : stderr=>error_unit implicit none private @@ -20,8 +20,11 @@ character(len=:),allocatable :: littlefile(:) write(stderr,'(*(g0,1x))')'fpm::new<ERROR>',settings%name,'already exists.' write(stderr,'(*(g0,1x))')' perhaps you wanted to add --backfill ?' return - elseif(exists(settings%name) .and. settings%backfill )then + elseif(is_dir(settings%name) .and. settings%backfill )then write(*,'(*(g0))')'backfilling ',settings%name + elseif(exists(settings%name) )then + write(stderr,'(*(g0,1x))')'fpm::new<ERROR>',settings%name,'already exists and is not a directory.' + return else call mkdir(settings%name) ! make new directory endif |