1
0
Fork 0
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:
Lux Aliaga 2022-09-14 23:59:57 -03:00
parent 50d8318d13
commit 6d10d77fbe

View file

@ -30,7 +30,7 @@ pub fn take(file: &String) {
let sourcepath: PathBuf = Path::new(&file).to_path_buf();
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());
} else if sourcepath.is_file() | sourcepath.is_symlink() {
fs::copy(&file, &destpath).expect("❌ Vento was unable to copy the file.");