@@ -669,8 +669,8 @@ sub run {
669
669
670
670
use parent qw( Perl::Dist::Strawberry) ;
671
671
672
- use File::Path qw( remove_tree) ;
673
- use File::Spec::Functions qw( canonpath) ;
672
+ use File::Path qw( remove_tree make_path ) ;
673
+ use File::Spec::Functions qw( canonpath catdir ) ;
674
674
use File::Glob qw( :glob) ;
675
675
use Time::HiRes qw( usleep) ;
676
676
use PerlBuildJob;
@@ -694,16 +694,39 @@ sub create_dirs {
694
694
foreach my $global (qw( image_dir build_dir debug_dir env_dir) ) {
695
695
my $dir = $self -> global-> {$global }
696
696
or next ;
697
- remove_tree($dir ) if -d $dir ;
697
+ next unless -d $dir ;
698
+
699
+ my $delete = ' ' ;
700
+ if ($global eq ' build_dir' ) {
701
+ $delete = catdir($dir , " msi" );
702
+ next unless -d $delete ;
703
+ } else {
704
+ $delete = $dir ;
705
+ }
706
+
707
+ remove_tree($delete ) or die " ERROR: cannot delete '$delete '\n " ;
698
708
699
709
# We may have some issue with fs synchro, be ready to wait a little
700
710
my $timeout = time + 10;
701
- while (-d $dir && time < $timeout ) {
711
+ while ($delete && -d $delete && time < $timeout ) {
702
712
usleep(100000);
703
713
}
714
+ -d $dir or make_path($dir ) or die " ERROR: cannot create '$dir '\n " ;
704
715
}
705
716
706
- $self -> SUPER::create_dirs();
717
+ my $wdir = $self -> global-> {working_dir };
718
+ unless (-d $wdir ) {
719
+ make_path($wdir ) or die " ERROR: cannot create '$wdir '\n " ;
720
+ }
721
+
722
+ make_path(catdir($self -> global-> {env_dir }, ' temp' ));
723
+ make_path(catdir($self -> global-> {env_dir }, ' AppDataRoaming' ));
724
+ make_path(catdir($self -> global-> {env_dir }, ' AppDataLocal' ));
725
+ make_path(catdir($self -> global-> {env_dir }, ' UserProfile' ));
726
+
727
+ # Create only if not exists
728
+ -d $self -> global-> {restore_dir } or make_path($self -> global-> {restore_dir }) or die " ERROR: cannot create '" .$self -> global-> {restore_dir }." '\n " ;
729
+ -d $self -> global-> {output_dir } or make_path($self -> global-> {output_dir }) or die " ERROR: cannot create '" .$self -> global-> {output_dir }." '\n " ;
707
730
}
708
731
709
732
sub ask_about_restorepoint {
0 commit comments