Skip to content

Commit

Permalink
fix: refactor the shortcut filename
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben-arts committed Mar 4, 2025
1 parent 655448e commit 27d8b6c
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions crates/rattler_menuinst/src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ pub struct Directories {
windows_terminal_settings_files: Vec<PathBuf>,
}

fn shortcut_filename(name: &str, ext: Option<&str>) -> String {
let ext = ext.unwrap_or("lnk");
format!("{name}{env}.{ext}")
}

/// On Windows we can create shortcuts in several places:
/// - Start Menu
/// - Desktop
Expand Down Expand Up @@ -132,7 +127,7 @@ impl WindowsMenu {
) -> Self {
let name = command.name.resolve(Environment::Base, placeholders);

let shortcut_name = shortcut_filename(&name, Some(SHORTCUT_EXTENSION));
let shortcut_name = format!("{name}.{SHORTCUT_EXTENSION}");

let location = directories
.start_menu
Expand Down Expand Up @@ -195,9 +190,7 @@ impl WindowsMenu {
}

fn path_for_script(&self) -> PathBuf {
self.prefix
.join("Menu")
.join(shortcut_filename(&self.name, Some("bat")))
self.prefix.join("Menu").join(format!("{}.bat", &self.name))
}

fn build_command(&self, with_arg1: bool) -> Result<Vec<String>, MenuInstError> {
Expand Down

0 comments on commit 27d8b6c

Please sign in to comment.