Skip to content

Commit 41506fa

Browse files
Hofer-Julianwolfvruben-arts
authored
fix: shortcut filename (#1136)
Co-authored-by: Wolf Vollprecht <w.vollprecht@gmail.com> Co-authored-by: Ruben Arts <ruben.arts@hotmail.com>
1 parent 3f484ae commit 41506fa

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

crates/rattler_menuinst/src/windows.rs

+2-24
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,6 @@ pub struct Directories {
3838
windows_terminal_settings_files: Vec<PathBuf>,
3939
}
4040

41-
fn shortcut_filename(name: &str, env_name: Option<&String>, ext: Option<&str>) -> String {
42-
let env = if let Some(env_name) = env_name {
43-
format!(" ({env_name})")
44-
} else {
45-
"".to_string()
46-
};
47-
48-
let ext = ext.unwrap_or("lnk");
49-
format!("{name}{env}{ext}")
50-
}
51-
5241
/// On Windows we can create shortcuts in several places:
5342
/// - Start Menu
5443
/// - Desktop
@@ -138,18 +127,13 @@ impl WindowsMenu {
138127
) -> Self {
139128
let name = command.name.resolve(Environment::Base, placeholders);
140129

141-
let shortcut_name = shortcut_filename(
142-
&name,
143-
placeholders.as_ref().get("ENV_NAME"),
144-
Some(SHORTCUT_EXTENSION),
145-
);
130+
let shortcut_name = format!("{name}.{SHORTCUT_EXTENSION}");
146131

147132
let location = directories
148133
.start_menu
149134
.join(&shortcut_name)
150135
.with_extension(SHORTCUT_EXTENSION);
151136

152-
// self.menu.start_menu_location / self._shortcut_filename()
153137
Self {
154138
prefix: prefix.to_path_buf(),
155139
name,
@@ -194,10 +178,6 @@ impl WindowsMenu {
194178
Ok(lines.join("\n"))
195179
}
196180

197-
fn shortcut_filename(&self, ext: Option<&str>) -> String {
198-
shortcut_filename(&self.name, self.placeholders.as_ref().get("ENV_NAME"), ext)
199-
}
200-
201181
fn write_script(&self, path: &Path) -> Result<(), MenuInstError> {
202182
if let Some(parent) = path.parent() {
203183
fs::create_dir_all(parent)?;
@@ -210,9 +190,7 @@ impl WindowsMenu {
210190
}
211191

212192
fn path_for_script(&self) -> PathBuf {
213-
self.prefix
214-
.join("Menu")
215-
.join(self.shortcut_filename(Some("bat")))
193+
self.prefix.join("Menu").join(format!("{}.bat", &self.name))
216194
}
217195

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

0 commit comments

Comments
 (0)