mirror of
https://git.sr.ht/~nixgoat/vento
synced 2024-11-16 03:53:04 +00:00
fixup! fixup! item: Implement taking files
This commit is contained in:
parent
50d8318d13
commit
6d10d77fbe
|
@ -30,7 +30,7 @@ pub fn take(file: &String) {
|
||||||
let sourcepath: PathBuf = Path::new(&file).to_path_buf();
|
let sourcepath: PathBuf = Path::new(&file).to_path_buf();
|
||||||
let destpath: PathBuf = [&active, &Path::new(file).to_path_buf()].iter().collect();
|
let destpath: PathBuf = [&active, &Path::new(file).to_path_buf()].iter().collect();
|
||||||
|
|
||||||
if Path::exists(&sourcepath) {
|
if Path::exists(&destpath) {
|
||||||
println!("❌ {}", format!("A file with the same name already exists in your inventory!").red());
|
println!("❌ {}", format!("A file with the same name already exists in your inventory!").red());
|
||||||
} else if sourcepath.is_file() | sourcepath.is_symlink() {
|
} else if sourcepath.is_file() | sourcepath.is_symlink() {
|
||||||
fs::copy(&file, &destpath).expect("❌ Vento was unable to copy the file.");
|
fs::copy(&file, &destpath).expect("❌ Vento was unable to copy the file.");
|
||||||
|
|
Loading…
Reference in a new issue