@@ -8,6 +8,11 @@ use crate::path::{Dirs, RelPath};
88use crate :: utils:: { copy_dir_recursively, ensure_empty_dir, spawn_and_wait} ;
99
1010pub ( crate ) fn prepare ( dirs : & Dirs ) {
11+ if dirs. download_dir . exists ( ) {
12+ let mut make_readwrite_cmd = Command :: new ( "chmod" ) ;
13+ make_readwrite_cmd. arg ( "-R" ) . arg ( "u+w" ) . arg ( "." ) . current_dir ( & dirs. download_dir ) ;
14+ spawn_and_wait ( make_readwrite_cmd) ;
15+ }
1116 std:: fs:: create_dir_all ( & dirs. download_dir ) . unwrap ( ) ;
1217 crate :: tests:: RAND_REPO . fetch ( dirs) ;
1318 crate :: tests:: REGEX_REPO . fetch ( dirs) ;
@@ -140,6 +145,10 @@ impl GitRepo {
140145 }
141146
142147 self . verify_checksum ( dirs) ;
148+
149+ let mut make_readonly_cmd = Command :: new ( "chmod" ) ;
150+ make_readonly_cmd. arg ( "-R" ) . arg ( "-w" ) . arg ( download_dir) ;
151+ spawn_and_wait ( make_readonly_cmd) ;
143152 }
144153
145154 pub ( crate ) fn patch ( & self , dirs : & Dirs ) {
@@ -150,6 +159,10 @@ impl GitRepo {
150159 & self . download_dir ( dirs) ,
151160 & self . source_dir ( ) . to_path ( dirs) ,
152161 ) ;
162+
163+ let mut make_readonly_cmd = Command :: new ( "chmod" ) ;
164+ make_readonly_cmd. arg ( "-R" ) . arg ( "-w" ) . arg ( self . source_dir ( ) . to_path ( dirs) ) ;
165+ spawn_and_wait ( make_readonly_cmd) ;
153166 }
154167}
155168
0 commit comments