Skip to content
Snippets Groups Projects
Commit e9ca4336 authored by Simon Sapin's avatar Simon Sapin
Browse files

Exit early if a tarball of that name already exists

parent c6a9a780
No related branches found
No related tags found
1 merge request!1Initial implementation
......@@ -33,4 +33,5 @@
.to_str()
.ok_or("Non-Unicode base name")?;
let archive_name = format!("{}.tar.zst", base_name);
let bold = style(&archive_name).bold();
......@@ -36,5 +37,10 @@
println!("About to create tmp/{}", style(&archive_name).bold());
let archive_path = self.tmp_dir.join(&archive_name);
if archive_path.exists() {
Err(format!("tmp/{} already exists", bold))?
}
println!("About to create tmp/{}", bold);
let proceed = Confirm::new()
.with_prompt("Continue?")
.default(false)
......@@ -43,7 +49,6 @@
Err("")?
}
let archive_path = self.tmp_dir.join(&archive_name);
let archive_file = std::fs::OpenOptions::new()
.write(true)
.create_new(true)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment