@@ -26,6 +26,7 @@ module fpm
26
26
& stderr = > error_unit
27
27
use iso_c_binding, only: c_char, c_ptr, c_int, c_null_char, c_associated, c_f_pointer
28
28
use fpm_environment, only: os_is_unix
29
+ use fpm_settings, only: fpm_global_settings, get_global_settings
29
30
30
31
implicit none
31
32
private
@@ -684,15 +685,23 @@ subroutine cmd_clean(settings)
684
685
class(fpm_clean_settings), intent (in ) :: settings
685
686
686
687
character :: user_response
688
+ type (fpm_global_settings) :: global_settings
689
+ type (error_t), allocatable :: error
690
+
691
+ ! Clear registry cache
692
+ if (settings% registry_cache) then
693
+ call get_global_settings(global_settings, error)
694
+ if (allocated (error)) return
695
+
696
+ call os_delete_dir(os_is_unix(), global_settings% registry_settings% cache_path)
697
+ end if
687
698
688
699
if (is_dir(' build' )) then
689
700
! Remove the entire build directory
690
701
if (settings% clean_all) then
691
702
call os_delete_dir(os_is_unix(), ' build' ); return
692
- end if
693
-
694
703
! Remove the build directory but skip dependencies
695
- if (settings% clean_skip) then
704
+ else if (settings% clean_skip) then
696
705
call delete_skip(os_is_unix()); return
697
706
end if
698
707
0 commit comments