aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinit current directory[i] <urbanjost@comcast.net>2020-10-11 06:10:52 -0400
committerLKedward <laurence.kedward@bristol.ac.uk>2020-10-12 11:57:59 +0100
commit51180c0d964415b3168c1cdd1fed9f29e3507858 (patch)
tree1d0ca67fe6d15c2437b4ce8a3ff3e975b43fac2b
parent70ae232ecbcfca102babe2b1fbdb08f4b14236b1 (diff)
downloadfpm-51180c0d964415b3168c1cdd1fed9f29e3507858.tar.gz
fpm-51180c0d964415b3168c1cdd1fed9f29e3507858.zip
check if name is a directory on backfill instead of depending on system command
-rw-r--r--fpm/src/fpm/cmd/new.f907
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