From 7f07c7636c086d20d6ec6cba5769e36388face38 Mon Sep 17 00:00:00 2001 From: objz Date: Mon, 24 Aug 2026 19:14:40 +0200 Subject: [PATCH] fix(migrate): find legacy desktop shortcuts by sanitized name mcl named shortcut files with the sanitized instance name, but the migration looked them up by raw display name and never matched; the windows lookup keeps the legacy .bat extension. --- src/migrate.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/migrate.rs b/src/migrate.rs index e9b73d7..c47743c 100644 --- a/src/migrate.rs +++ b/src/migrate.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2026 Constantin Bauer +// SPDX-License-Identifier: GPL-3.0-only + //! Legacy mcl→rmcl path migration. Runs once before any other init in main(). //! Idempotent: absence of the old dir is the sentinel. @@ -135,6 +138,8 @@ fn rewrite_linux_desktop_entries(_data_dir: &Path, _instances_dir: &Path) { fn rewrite_native_desktop_shortcuts(_desktop_dir: &Path, _instances_dir: &Path) { #[cfg(any(target_os = "windows", target_os = "macos"))] { + // mcl-era windows shortcuts were .bat files; current rmcl writes + // .vbs, so only the legacy extension is rewritten here. let ext = if cfg!(target_os = "windows") { "bat" } else { @@ -145,7 +150,10 @@ fn rewrite_native_desktop_shortcuts(_desktop_dir: &Path, _instances_dir: &Path) }; for entry in entries.flatten() { let display = entry.file_name().to_string_lossy().into_owned(); - let path = _desktop_dir.join(format!("Minecraft - {display}.{ext}")); + // mcl named shortcut files with the sanitized form of the + // instance name ("My Pack" -> "My_Pack"), so look those up. + let sanitized = sanitize(&display); + let path = _desktop_dir.join(format!("Minecraft - {sanitized}.{ext}")); if !path.exists() { continue; }