mirror of https://git.sr.ht/~nixgoat/vento
item: Fix taking files recursively
This should fix an issue which made it impossible to take files from directories other than the one the user is sitting at.
This commit is contained in:
parent
6ec32037db
commit
a98a8147e9
15
src/item.rs
15
src/item.rs
|
@ -55,7 +55,20 @@ pub fn take(file: &String, slot: &String) -> Result<()> {
|
|||
};
|
||||
|
||||
let sourcepath: PathBuf = Path::new(&file).to_path_buf();
|
||||
let destpath: PathBuf = [&slotdir, &Path::new(file).to_path_buf()].iter().collect();
|
||||
let destpath: PathBuf = [
|
||||
&slotdir,
|
||||
&Path::new(
|
||||
&Path::new(&file)
|
||||
.file_name()
|
||||
.unwrap()
|
||||
.to_os_string()
|
||||
.to_str()
|
||||
.unwrap(),
|
||||
)
|
||||
.to_path_buf(),
|
||||
]
|
||||
.iter()
|
||||
.collect();
|
||||
|
||||
if Path::exists(&destpath) {
|
||||
// Checks if there's a file with the same name in the inventory.
|
||||
|
|
Loading…
Reference in New Issue