@@ -2,7 +2,7 @@ module fpm_cmd_new
2
2
3
3
use fpm_command_line, only : fpm_new_settings
4
4
use fpm_environment, only : run, OS_LINUX, OS_MACOS, OS_WINDOWS
5
- use fpm_filesystem, only : join_path, exists, basename, mkdir
5
+ use fpm_filesystem, only : join_path, exists, basename, mkdir, is_dir
6
6
use ,intrinsic :: iso_fortran_env, only : stderr= >error_unit
7
7
implicit none
8
8
private
@@ -20,8 +20,11 @@ subroutine cmd_new(settings) ! --with-executable F --with-test F '
20
20
write (stderr,' (*(g0,1x))' )' fpm::new<ERROR>' ,settings% name,' already exists.'
21
21
write (stderr,' (*(g0,1x))' )' perhaps you wanted to add --backfill ?'
22
22
return
23
- elseif (exists (settings% name) .and. settings% backfill )then
23
+ elseif (is_dir (settings% name) .and. settings% backfill )then
24
24
write (* ,' (*(g0))' )' backfilling ' ,settings% name
25
+ elseif (exists(settings% name) )then
26
+ write (stderr,' (*(g0,1x))' )' fpm::new<ERROR>' ,settings% name,' already exists and is not a directory.'
27
+ return
25
28
else
26
29
call mkdir(settings% name) ! make new directory
27
30
endif
0 commit comments