mirror of
https://github.com/chmln/handlr.git
synced 2024-11-27 03:13:49 +01:00
Fix launch
without any args
This commit is contained in:
parent
a791b6f016
commit
e682e42bcb
1 changed files with 9 additions and 9 deletions
|
@ -114,16 +114,16 @@ impl DesktopEntry {
|
|||
&self,
|
||||
arg: Option<String>,
|
||||
) -> Result<(String, Vec<String>)> {
|
||||
let arg = arg.unwrap_or_default();
|
||||
let arg = shlex::quote(&arg);
|
||||
let replaced = self
|
||||
.exec
|
||||
.replace("%f", &arg)
|
||||
.replace("%F", &arg)
|
||||
.replace("%u", &arg)
|
||||
.replace("%U", &arg);
|
||||
let mut split = shlex::split(&self.exec)
|
||||
.ok_or(Error::BadCmd)?
|
||||
.into_iter()
|
||||
.map(|s| match s.as_str() {
|
||||
"%f" | "%F" | "%u" | "%U" => arg.clone(),
|
||||
_ => Some(s),
|
||||
})
|
||||
.filter_map(std::convert::identity)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let mut split = shlex::split(&replaced).ok_or(Error::BadCmd)?;
|
||||
Ok((split.remove(0), split))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue