Skip to content

Commit d9b272f

Browse files
committed
add clean calling directory
1 parent 4e13822 commit d9b272f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/fpm.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ end subroutine cmd_run
506506
subroutine cmd_clean(settings)
507507
class(fpm_clean_settings), intent(in) :: settings
508508
character(len=1) :: response
509+
write(stdout, '(*(a))') "fpm: Clean calling directory '"//settings%calling_dir//"'"
509510
if (is_dir("build")) then
510511
write(stdout, '(A)', advance='no') "Delete the build directory (y/n)? "
511512
read(stdin, '(A1)') response

src/fpm_command_line.f90

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ module fpm_command_line
106106
end type
107107

108108
type, extends(fpm_cmd_settings) :: fpm_clean_settings
109-
logical :: unix
109+
logical :: unix ! is the system os unix?
110+
character(len=:), allocatable :: calling_dir ! directory clean called from
110111
end type
111112

112113
character(len=:),allocatable :: name
@@ -481,6 +482,7 @@ subroutine get_command_line_settings(cmd_settings)
481482
if(lget('list'))then
482483
call printhelp(help_list_dash)
483484
endif
485+
484486
case('test')
485487
call set_args(common_args // compiler_args // run_args // ' --', &
486488
help_test,version_text)
@@ -543,7 +545,8 @@ subroutine get_command_line_settings(cmd_settings)
543545
case('clean')
544546
call set_args(common_args, help_clean)
545547
allocate(fpm_clean_settings :: cmd_settings)
546-
cmd_settings=fpm_clean_settings(unix=unix)
548+
call get_current_directory(working_dir, error)
549+
cmd_settings=fpm_clean_settings(unix=unix, calling_dir=working_dir)
547550

548551
case default
549552

0 commit comments

Comments
 (0)