Skip to content

Commit 07c55e4

Browse files
committed
[DO NOT MERGE] Make download dir read-only
1 parent fdca75c commit 07c55e4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

build_system/prepare.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ use crate::path::{Dirs, RelPath};
88
use crate::utils::{copy_dir_recursively, ensure_empty_dir, spawn_and_wait};
99

1010
pub(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

Comments
 (0)