Skip to content

Commit

Permalink
linux
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Nov 10, 2024
1 parent ce30ab0 commit b030063
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions crates/rattler_menuinst/src/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,29 @@ impl LinuxMenu {
// f.write("\n".join(lines))
// f.write("\n")

fn command(&self) -> String {
let mut parts = Vec::new();
if let Some(pre_command) = &self.command.precommand {
parts.push(pre_command.resolve(&self.placeholders));
}

if self.command.activate.unwrap_or(false) {
// TODO implement activation here!
}

let command = self
.command
.command
.iter()
.map(|s| s.resolve(&self.placeholders))
.collect::<Vec<_>>()
.join(" ");

parts.push(command);

return parts.join(" && ");

Check failure on line 186 in crates/rattler_menuinst/src/linux.rs

View workflow job for this annotation

GitHub Actions / Format and Lint

unneeded `return` statement
}

fn create_desktop_entry(&self) -> Result<(), MenuInstError> {
let file = self.location();
let writer = File::create(file)?;
Expand All @@ -172,16 +195,7 @@ impl LinuxMenu {
writeln!(writer, "Type=Application")?;
writeln!(writer, "Encoding=UTF-8")?;
writeln!(writer, "Name={:?}", self.command.name)?;
writeln!(
writer,
"Exec={}",
self.command
.command
.iter()
.map(|s| s.resolve(&self.placeholders))
.collect::<Vec<_>>()
.join(" ")
)?;
writeln!(writer, "Exec={}", self.command())?;
writeln!(
writer,
"Terminal={}",
Expand Down

0 comments on commit b030063

Please sign in to comment.