add trash flag

This commit is contained in:
Dominic Gerhauser 2024-03-17 03:03:49 +01:00 • committed by Jeremy Soller
parent 1b69c3bf5c
commit 2e63774882

View file

@ -668,12 +668,16 @@ impl Application for App {
let mut commands = Vec::new(); let mut commands = Vec::new();
for arg in env::args().skip(1) { for arg in env::args().skip(1) {
let location = match fs::canonicalize(&arg) { let location = if &arg == "--trash" {
Location::Trash
} else {
match fs::canonicalize(&arg) {
Ok(absolute) => Location::Path(absolute), Ok(absolute) => Location::Path(absolute),
Err(err) => { Err(err) => {
log::warn!("failed to canonicalize {:?}: {}", arg, err); log::warn!("failed to canonicalize {:?}: {}", arg, err);
continue; continue;
} }
}
}; };
commands.push(app.open_tab(location)); commands.push(app.open_tab(location));
} }