diff --git a/Cargo.lock b/Cargo.lock index c711d1b..b94eeed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3157,7 +3157,7 @@ dependencies = [ [[package]] name = "rmcl" -version = "0.3.0" +version = "0.3.1" dependencies = [ "async-trait", "chrono", diff --git a/Cargo.toml b/Cargo.toml index ed11178..a1a1bf8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "rmcl" -version = "0.3.0" +version = "0.3.1" authors = ["objz"] edition = "2024" -description = "A fully featured Minecraft launcher TUI" +description = "A fully featured Minecraft TUI launcher" repository = "https://github.com/objz/rmcl" homepage = "https://github.com/objz/rmcl" license = "GPL-3.0-only" diff --git a/src/cli/instance.rs b/src/cli/instance.rs index 9fc7f17..12f9d0c 100644 --- a/src/cli/instance.rs +++ b/src/cli/instance.rs @@ -143,16 +143,15 @@ async fn launch_instance(matches: &ArgMatches) -> CliResult { loop { match crate::running::get(name) { Some(RunState::Crashed(Some(code))) => { - println!("Game exited with status {}.", code); + println!("Game exited with status {}", code); break; } Some(RunState::Crashed(None)) => { - println!("Game was terminated."); + println!("Game was terminated"); break; } Some(_) => tokio::time::sleep(Duration::from_millis(500)).await, None => { - println!("Game exited with status 0."); break; } } diff --git a/src/instance/desktop.rs b/src/instance/desktop.rs index 0578838..08cc959 100644 --- a/src/instance/desktop.rs +++ b/src/instance/desktop.rs @@ -20,7 +20,7 @@ pub fn desktop_path(name: &str) -> Option { #[cfg(target_os = "windows")] { - dirs::desktop_dir().map(|d| d.join(format!("Minecraft - {sanitized}.bat"))) + dirs::desktop_dir().map(|d| d.join(format!("Minecraft - {sanitized}.vbs"))) } #[cfg(target_os = "macos")] @@ -141,7 +141,7 @@ fn build_content(name: &str, icon: Option<&Path>) -> String { fn build_linux_desktop(name: &str, icon: Option<&Path>) -> String { let mut out = String::new(); out.push_str("[Desktop Entry]\n"); - out.push_str("Version=1.0\n"); + out.push_str("Version=0.3.1\n"); out.push_str("Type=Application\n"); out.push_str(&format!("Name=Minecraft - {name}\n")); out.push_str(&format!("Comment=Launch {name} Minecraft instance\n")); @@ -149,18 +149,21 @@ fn build_linux_desktop(name: &str, icon: Option<&Path>) -> String { if let Some(icon) = icon { out.push_str(&format!("Icon={}\n", icon.display())); } - out.push_str("Terminal=true\n"); + out.push_str("Terminal=false\n"); out.push_str("Categories=Game;\n"); out } #[cfg(target_os = "windows")] fn build_windows_shortcut(name: &str) -> String { + let escaped_name = name.replace('"', "\"\""); + let mut out = String::new(); - out.push_str("@echo off\r\n"); - out.push_str(&format!("title Minecraft - {name}\r\n")); - out.push_str(&format!("rmcl instance launch \"{name}\"\r\n")); - out.push_str("pause\r\n"); + out.push_str("Set shell = CreateObject(\"WScript.Shell\")\r\n"); + out.push_str(&format!( + "shell.Run \"rmcl instance launch \"\"{}\"\"\", 0, False\r\n", + escaped_name + )); out } @@ -207,7 +210,7 @@ mod tests { let content = build_content("TestPack", None); assert!(content.contains("Name=Minecraft - TestPack")); assert!(content.contains("Exec=rmcl instance launch \"TestPack\"")); - assert!(content.contains("Terminal=true")); + assert!(content.contains("Terminal=false")); assert!(content.contains("Categories=Game;")); }