chore(0.3.1
This commit is contained in:
1 parent
10bfe8ad2f
commit
4197beea3c
4 files changed
+16
-14
No files matched your search
Generated
+1
-1
@@ -3157,7 +3157,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rmcl"
|
name = "rmcl"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rmcl"
|
name = "rmcl"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
authors = ["objz"]
|
authors = ["objz"]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "A fully featured Minecraft launcher TUI"
|
description = "A fully featured Minecraft TUI launcher"
|
||||||
repository = "https://github.com/objz/rmcl"
|
repository = "https://github.com/objz/rmcl"
|
||||||
homepage = "https://github.com/objz/rmcl"
|
homepage = "https://github.com/objz/rmcl"
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
|
|||||||
+2
-3
@@ -143,16 +143,15 @@ async fn launch_instance(matches: &ArgMatches) -> CliResult {
|
|||||||
loop {
|
loop {
|
||||||
match crate::running::get(name) {
|
match crate::running::get(name) {
|
||||||
Some(RunState::Crashed(Some(code))) => {
|
Some(RunState::Crashed(Some(code))) => {
|
||||||
println!("Game exited with status {}.", code);
|
println!("Game exited with status {}", code);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Some(RunState::Crashed(None)) => {
|
Some(RunState::Crashed(None)) => {
|
||||||
println!("Game was terminated.");
|
println!("Game was terminated");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Some(_) => tokio::time::sleep(Duration::from_millis(500)).await,
|
Some(_) => tokio::time::sleep(Duration::from_millis(500)).await,
|
||||||
None => {
|
None => {
|
||||||
println!("Game exited with status 0.");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-8
@@ -20,7 +20,7 @@ pub fn desktop_path(name: &str) -> Option<PathBuf> {
|
|||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[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")]
|
#[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 {
|
fn build_linux_desktop(name: &str, icon: Option<&Path>) -> String {
|
||||||
let mut out = String::new();
|
let mut out = String::new();
|
||||||
out.push_str("[Desktop Entry]\n");
|
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("Type=Application\n");
|
||||||
out.push_str(&format!("Name=Minecraft - {name}\n"));
|
out.push_str(&format!("Name=Minecraft - {name}\n"));
|
||||||
out.push_str(&format!("Comment=Launch {name} Minecraft instance\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 {
|
if let Some(icon) = icon {
|
||||||
out.push_str(&format!("Icon={}\n", icon.display()));
|
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.push_str("Categories=Game;\n");
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
fn build_windows_shortcut(name: &str) -> String {
|
fn build_windows_shortcut(name: &str) -> String {
|
||||||
|
let escaped_name = name.replace('"', "\"\"");
|
||||||
|
|
||||||
let mut out = String::new();
|
let mut out = String::new();
|
||||||
out.push_str("@echo off\r\n");
|
out.push_str("Set shell = CreateObject(\"WScript.Shell\")\r\n");
|
||||||
out.push_str(&format!("title Minecraft - {name}\r\n"));
|
out.push_str(&format!(
|
||||||
out.push_str(&format!("rmcl instance launch \"{name}\"\r\n"));
|
"shell.Run \"rmcl instance launch \"\"{}\"\"\", 0, False\r\n",
|
||||||
out.push_str("pause\r\n");
|
escaped_name
|
||||||
|
));
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +210,7 @@ mod tests {
|
|||||||
let content = build_content("TestPack", None);
|
let content = build_content("TestPack", None);
|
||||||
assert!(content.contains("Name=Minecraft - TestPack"));
|
assert!(content.contains("Name=Minecraft - TestPack"));
|
||||||
assert!(content.contains("Exec=rmcl instance launch \"TestPack\""));
|
assert!(content.contains("Exec=rmcl instance launch \"TestPack\""));
|
||||||
assert!(content.contains("Terminal=true"));
|
assert!(content.contains("Terminal=false"));
|
||||||
assert!(content.contains("Categories=Game;"));
|
assert!(content.contains("Categories=Game;"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user