fix: remove contents of dir rather than repo dir

main
Michal 2 years ago
parent ecdfd2148f
commit 323c5ac821
No known key found for this signature in database
GPG Key ID: 52F8801FC912EB4F

@ -27,16 +27,21 @@ pub fn generate(verbose: bool) {
info!("Generating repository: {}", name); info!("Generating repository: {}", name);
// If repository exists, delete it // If repository exists, empty it
if Path::exists(name.as_ref()) { if Path::exists(name.as_ref()) {
log!(verbose, "Deleting {}", name); log!(verbose, "Deleting contents of {}", name);
fs::remove_dir_all(&name).unwrap(); Command::new("bash")
.args(&["-c", &format!("rm -rf {}/*", &name)])
.spawn()
.unwrap()
.wait()
.unwrap(); // Dirty temp hack but oh well
} else {
// Create dir if it doesn't exist
fs::create_dir_all(&name).unwrap();
log!(verbose, "Created {}", name);
} }
// Create or recreate repository directory
fs::create_dir_all(&name).unwrap();
log!(verbose, "Created {}", name);
// Copy out packages to repository directory // Copy out packages to repository directory
Command::new("bash") Command::new("bash")
.args(&["-c", &format!("cp -v out/* {}/", &name)]) .args(&["-c", &format!("cp -v out/* {}/", &name)])

Loading…
Cancel
Save