feat!: rename project from mcl/mcl-launcher to rmcl
Renames Cargo package, binary, internal path identifiers, java shim, user-agent, log filename, desktop shortcut Exec lines, and CLI program name. Wires src/migrate.rs into main() so existing users have their on-disk data (~/.config/mcl/, ~/.local/share/mcl/, ~/.cache/mcl/) moved to the new locations on first launch. BREAKING CHANGE: binary is now named rmcl. Old paths are auto-migrated.
This commit is contained in:
1 parent
2b3aa4df32
commit
ae2524f2ce
16 files changed
+96
-91
No files matched your search
Generated
+43
-43
@@ -1953,49 +1953,6 @@ dependencies = [
|
|||||||
"regex-automata",
|
"regex-automata",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mcl-launcher"
|
|
||||||
version = "0.2.4"
|
|
||||||
dependencies = [
|
|
||||||
"async-trait",
|
|
||||||
"chrono",
|
|
||||||
"clap",
|
|
||||||
"color-eyre",
|
|
||||||
"config",
|
|
||||||
"crossterm 0.29.0",
|
|
||||||
"dirs",
|
|
||||||
"dirs-next",
|
|
||||||
"image",
|
|
||||||
"log",
|
|
||||||
"minecraft-msa-auth",
|
|
||||||
"notify",
|
|
||||||
"oauth2",
|
|
||||||
"open",
|
|
||||||
"ratatui",
|
|
||||||
"ratatui-image",
|
|
||||||
"ratatui-textarea",
|
|
||||||
"ratatui-themekit",
|
|
||||||
"reqwest",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"tachyonfx",
|
|
||||||
"tempfile",
|
|
||||||
"thiserror 2.0.18",
|
|
||||||
"throbber-widgets-tui",
|
|
||||||
"tokio",
|
|
||||||
"toml",
|
|
||||||
"tracing",
|
|
||||||
"tracing-appender",
|
|
||||||
"tracing-subscriber",
|
|
||||||
"tui-logger",
|
|
||||||
"tui-popup",
|
|
||||||
"tui-prompts",
|
|
||||||
"tui-scrollview",
|
|
||||||
"tui-widget-list",
|
|
||||||
"which",
|
|
||||||
"zip",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.8.0"
|
version = "2.8.0"
|
||||||
@@ -3043,6 +3000,49 @@ dependencies = [
|
|||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rmcl"
|
||||||
|
version = "0.3.0"
|
||||||
|
dependencies = [
|
||||||
|
"async-trait",
|
||||||
|
"chrono",
|
||||||
|
"clap",
|
||||||
|
"color-eyre",
|
||||||
|
"config",
|
||||||
|
"crossterm 0.29.0",
|
||||||
|
"dirs",
|
||||||
|
"dirs-next",
|
||||||
|
"image",
|
||||||
|
"log",
|
||||||
|
"minecraft-msa-auth",
|
||||||
|
"notify",
|
||||||
|
"oauth2",
|
||||||
|
"open",
|
||||||
|
"ratatui",
|
||||||
|
"ratatui-image",
|
||||||
|
"ratatui-textarea",
|
||||||
|
"ratatui-themekit",
|
||||||
|
"reqwest",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"tachyonfx",
|
||||||
|
"tempfile",
|
||||||
|
"thiserror 2.0.18",
|
||||||
|
"throbber-widgets-tui",
|
||||||
|
"tokio",
|
||||||
|
"toml",
|
||||||
|
"tracing",
|
||||||
|
"tracing-appender",
|
||||||
|
"tracing-subscriber",
|
||||||
|
"tui-logger",
|
||||||
|
"tui-popup",
|
||||||
|
"tui-prompts",
|
||||||
|
"tui-scrollview",
|
||||||
|
"tui-widget-list",
|
||||||
|
"which",
|
||||||
|
"zip",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ron"
|
name = "ron"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
|
|||||||
+5
-5
@@ -1,11 +1,11 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mcl-launcher"
|
name = "rmcl"
|
||||||
version = "0.2.4"
|
version = "0.3.0"
|
||||||
authors = ["objz"]
|
authors = ["objz"]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "A fully featured Minecraft launcher TUI"
|
description = "A fully featured Minecraft launcher TUI"
|
||||||
repository = "https://github.com/objz/mcl"
|
repository = "https://github.com/objz/rmcl"
|
||||||
homepage = "https://github.com/objz/mcl"
|
homepage = "https://github.com/objz/rmcl"
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["minecraft", "launcher", "tui", "ratatui"]
|
keywords = ["minecraft", "launcher", "tui", "ratatui"]
|
||||||
@@ -18,7 +18,7 @@ license = false
|
|||||||
eula = false
|
eula = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "mcl"
|
name = "rmcl"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ use std::path::Path;
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("cargo:rerun-if-changed=java/MclShim.java");
|
println!("cargo:rerun-if-changed=java/RmclShim.java");
|
||||||
|
|
||||||
let out_dir = env::var("OUT_DIR").unwrap();
|
let out_dir = env::var("OUT_DIR").unwrap();
|
||||||
let out = Path::new(&out_dir);
|
let out = Path::new(&out_dir);
|
||||||
|
|
||||||
// compile MclShim.java into a jar that gets embedded via include_bytes!
|
// compile RmclShim.java into a jar that gets embedded via include_bytes!
|
||||||
let status = Command::new("javac")
|
let status = Command::new("javac")
|
||||||
.arg("-source")
|
.arg("-source")
|
||||||
.arg("8")
|
.arg("8")
|
||||||
@@ -16,23 +16,23 @@ fn main() {
|
|||||||
.arg("8")
|
.arg("8")
|
||||||
.arg("-d")
|
.arg("-d")
|
||||||
.arg(out.to_str().unwrap())
|
.arg(out.to_str().unwrap())
|
||||||
.arg("java/MclShim.java")
|
.arg("java/RmclShim.java")
|
||||||
.status()
|
.status()
|
||||||
.expect("Failed to run javac - is a JDK installed?");
|
.expect("Failed to run javac - is a JDK installed?");
|
||||||
|
|
||||||
assert!(status.success(), "javac failed to compile MclShim.java");
|
assert!(status.success(), "javac failed to compile RmclShim.java");
|
||||||
|
|
||||||
// package into a jar
|
// package into a jar
|
||||||
let jar_path = out.join("mcl-shim.jar");
|
let jar_path = out.join("rmcl-shim.jar");
|
||||||
let status = Command::new("jar")
|
let status = Command::new("jar")
|
||||||
.arg("cfe")
|
.arg("cfe")
|
||||||
.arg(jar_path.to_str().unwrap())
|
.arg(jar_path.to_str().unwrap())
|
||||||
.arg("MclShim")
|
.arg("RmclShim")
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(out.to_str().unwrap())
|
.arg(out.to_str().unwrap())
|
||||||
.arg("MclShim.class")
|
.arg("RmclShim.class")
|
||||||
.status()
|
.status()
|
||||||
.expect("Failed to run jar - is a JDK installed?");
|
.expect("Failed to run jar - is a JDK installed?");
|
||||||
|
|
||||||
assert!(status.success(), "jar failed to create mcl-shim.jar");
|
assert!(status.success(), "jar failed to create rmcl-shim.jar");
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class MclShim {
|
public class RmclShim {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
System.err.println("Usage: MclShim <mainClass> [args...]");
|
System.err.println("Usage: RmclShim <mainClass> [args...]");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
+1
-1
@@ -93,7 +93,7 @@ mod tests {
|
|||||||
|
|
||||||
fn unique_temp_dir() -> std::path::PathBuf {
|
fn unique_temp_dir() -> std::path::PathBuf {
|
||||||
std::env::temp_dir().join(format!(
|
std::env::temp_dir().join(format!(
|
||||||
"mcl_cli_log_test_{}",
|
"rmcl_cli_log_test_{}",
|
||||||
std::time::SystemTime::now()
|
std::time::SystemTime::now()
|
||||||
.duration_since(std::time::UNIX_EPOCH)
|
.duration_since(std::time::UNIX_EPOCH)
|
||||||
.expect("time should work")
|
.expect("time should work")
|
||||||
|
|||||||
+3
-3
@@ -14,7 +14,7 @@ use clap::{Arg, ArgAction, ArgGroup, Command};
|
|||||||
pub async fn init() {
|
pub async fn init() {
|
||||||
let matches = build_command().get_matches();
|
let matches = build_command().get_matches();
|
||||||
|
|
||||||
// no subcommand means the user just ran `mcl` bare, so fall through to TUI mode
|
// no subcommand means the user just ran `rmcl` bare, so fall through to TUI mode
|
||||||
if matches.subcommand().is_none() {
|
if matches.subcommand().is_none() {
|
||||||
// force-init the theme so it's ready before the TUI renders
|
// force-init the theme so it's ready before the TUI renders
|
||||||
let _ = &*crate::config::theme::THEME;
|
let _ = &*crate::config::theme::THEME;
|
||||||
@@ -43,7 +43,7 @@ pub async fn init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn build_command() -> Command {
|
fn build_command() -> Command {
|
||||||
Command::new("mcl")
|
Command::new("rmcl")
|
||||||
.about("Minecraft CLI Launcher")
|
.about("Minecraft CLI Launcher")
|
||||||
.version(env!("CARGO_PKG_VERSION"))
|
.version(env!("CARGO_PKG_VERSION"))
|
||||||
.subcommand_required(false)
|
.subcommand_required(false)
|
||||||
@@ -245,7 +245,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn parses_instance_list_subcommand() {
|
fn parses_instance_list_subcommand() {
|
||||||
let matches = build_command()
|
let matches = build_command()
|
||||||
.try_get_matches_from(["mcl", "instance", "list"])
|
.try_get_matches_from(["rmcl", "instance", "list"])
|
||||||
.expect("command should parse");
|
.expect("command should parse");
|
||||||
assert!(matches.subcommand_matches("instance").is_some());
|
assert!(matches.subcommand_matches("instance").is_some());
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ pub use settings::Config;
|
|||||||
pub fn get_config_path() -> PathBuf {
|
pub fn get_config_path() -> PathBuf {
|
||||||
dirs_next::config_dir()
|
dirs_next::config_dir()
|
||||||
.unwrap_or_else(|| PathBuf::from("."))
|
.unwrap_or_else(|| PathBuf::from("."))
|
||||||
.join("mcl")
|
.join("rmcl")
|
||||||
}
|
}
|
||||||
|
|
||||||
// seeds the config file from the bundled default on first run
|
// seeds the config file from the bundled default on first run
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub struct Paths {
|
|||||||
fn default_instances_dir() -> String {
|
fn default_instances_dir() -> String {
|
||||||
dirs_next::data_dir()
|
dirs_next::data_dir()
|
||||||
.unwrap_or_else(|| PathBuf::from("."))
|
.unwrap_or_else(|| PathBuf::from("."))
|
||||||
.join("mcl")
|
.join("rmcl")
|
||||||
.join("instances")
|
.join("instances")
|
||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.into_owned()
|
.into_owned()
|
||||||
@@ -30,7 +30,7 @@ fn default_instances_dir() -> String {
|
|||||||
fn default_meta_dir() -> String {
|
fn default_meta_dir() -> String {
|
||||||
dirs_next::data_dir()
|
dirs_next::data_dir()
|
||||||
.unwrap_or_else(|| PathBuf::from("."))
|
.unwrap_or_else(|| PathBuf::from("."))
|
||||||
.join("mcl")
|
.join("rmcl")
|
||||||
.join("meta")
|
.join("meta")
|
||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.into_owned()
|
.into_owned()
|
||||||
@@ -181,14 +181,14 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn resolve_path_absolute() {
|
fn resolve_path_absolute() {
|
||||||
assert_eq!(resolve_path("/opt/mcl"), PathBuf::from("/opt/mcl"));
|
assert_eq!(resolve_path("/opt/rmcl"), PathBuf::from("/opt/rmcl"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn resolve_path_tilde_prefix() {
|
fn resolve_path_tilde_prefix() {
|
||||||
let resolved = resolve_path("~/games/mcl");
|
let resolved = resolve_path("~/games/rmcl");
|
||||||
assert!(!resolved.to_string_lossy().starts_with('~'));
|
assert!(!resolved.to_string_lossy().starts_with('~'));
|
||||||
assert!(resolved.to_string_lossy().ends_with("games/mcl"));
|
assert!(resolved.to_string_lossy().ends_with("games/rmcl"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -200,22 +200,22 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn resolve_instances_dir_absolute() {
|
fn resolve_instances_dir_absolute() {
|
||||||
let paths = Paths {
|
let paths = Paths {
|
||||||
instances_dir: "/opt/mcl/instances".to_owned(),
|
instances_dir: "/opt/rmcl/instances".to_owned(),
|
||||||
..Paths::default()
|
..Paths::default()
|
||||||
};
|
};
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
paths.resolve_instances_dir(),
|
paths.resolve_instances_dir(),
|
||||||
PathBuf::from("/opt/mcl/instances")
|
PathBuf::from("/opt/rmcl/instances")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn resolve_meta_dir_absolute() {
|
fn resolve_meta_dir_absolute() {
|
||||||
let paths = Paths {
|
let paths = Paths {
|
||||||
meta_dir: "/opt/mcl/meta".to_owned(),
|
meta_dir: "/opt/rmcl/meta".to_owned(),
|
||||||
..Paths::default()
|
..Paths::default()
|
||||||
};
|
};
|
||||||
assert_eq!(paths.resolve_meta_dir(), PathBuf::from("/opt/mcl/meta"));
|
assert_eq!(paths.resolve_meta_dir(), PathBuf::from("/opt/rmcl/meta"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ pub fn desktop_path(name: &str) -> Option<PathBuf> {
|
|||||||
{
|
{
|
||||||
dirs_next::data_dir().map(|d| {
|
dirs_next::data_dir().map(|d| {
|
||||||
d.join("applications")
|
d.join("applications")
|
||||||
.join(format!("mcl-{sanitized}.desktop"))
|
.join(format!("rmcl-{sanitized}.desktop"))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ pub fn desktop_path(name: &str) -> Option<PathBuf> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn icon_path() -> Option<PathBuf> {
|
pub fn icon_path() -> Option<PathBuf> {
|
||||||
dirs_next::data_dir().map(|d| d.join("mcl").join("icon.svg"))
|
dirs_next::data_dir().map(|d| d.join("rmcl").join("icon.svg"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// lazily writes the bundled svg icon to disk the first time a shortcut needs it
|
// lazily writes the bundled svg icon to disk the first time a shortcut needs it
|
||||||
@@ -145,7 +145,7 @@ fn build_linux_desktop(name: &str, icon: Option<&Path>) -> String {
|
|||||||
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"));
|
||||||
out.push_str(&format!("Exec=mcl instance launch \"{name}\"\n"));
|
out.push_str(&format!("Exec=rmcl instance launch \"{name}\"\n"));
|
||||||
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()));
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ fn build_windows_shortcut(name: &str) -> String {
|
|||||||
let mut out = String::new();
|
let mut out = String::new();
|
||||||
out.push_str("@echo off\r\n");
|
out.push_str("@echo off\r\n");
|
||||||
out.push_str(&format!("title Minecraft - {name}\r\n"));
|
out.push_str(&format!("title Minecraft - {name}\r\n"));
|
||||||
out.push_str(&format!("mcl instance launch \"{name}\"\r\n"));
|
out.push_str(&format!("rmcl instance launch \"{name}\"\r\n"));
|
||||||
out.push_str("pause\r\n");
|
out.push_str("pause\r\n");
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ fn build_macos_command(name: &str) -> String {
|
|||||||
let mut out = String::new();
|
let mut out = String::new();
|
||||||
out.push_str("#!/bin/bash\n");
|
out.push_str("#!/bin/bash\n");
|
||||||
out.push_str(&format!("# Launch Minecraft instance: {name}\n"));
|
out.push_str(&format!("# Launch Minecraft instance: {name}\n"));
|
||||||
out.push_str(&format!("mcl instance launch \"{name}\"\n"));
|
out.push_str(&format!("rmcl instance launch \"{name}\"\n"));
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ mod tests {
|
|||||||
fn build_content_linux() {
|
fn build_content_linux() {
|
||||||
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=mcl instance launch \"TestPack\""));
|
assert!(content.contains("Exec=rmcl instance launch \"TestPack\""));
|
||||||
assert!(content.contains("Terminal=true"));
|
assert!(content.contains("Terminal=true"));
|
||||||
assert!(content.contains("Categories=Game;"));
|
assert!(content.contains("Categories=Game;"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,17 +83,17 @@ pub async fn apply(
|
|||||||
|
|
||||||
Some(LwjglifyPatches {
|
Some(LwjglifyPatches {
|
||||||
jvm_args,
|
jvm_args,
|
||||||
main_class: "MclShim".to_string(),
|
main_class: "RmclShim".to_string(),
|
||||||
extra_args: vec!["com.gtnewhorizons.retrofuturabootstrap.Main".to_string()],
|
extra_args: vec!["com.gtnewhorizons.retrofuturabootstrap.Main".to_string()],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const SHIM_JAR: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/mcl-shim.jar"));
|
const SHIM_JAR: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/rmcl-shim.jar"));
|
||||||
|
|
||||||
fn deploy_shim(minecraft_dir: &Path) -> PathBuf {
|
fn deploy_shim(minecraft_dir: &Path) -> PathBuf {
|
||||||
let dest = minecraft_dir.join(".mcl-shim.jar");
|
let dest = minecraft_dir.join(".rmcl-shim.jar");
|
||||||
if let Err(e) = std::fs::write(&dest, SHIM_JAR) {
|
if let Err(e) = std::fs::write(&dest, SHIM_JAR) {
|
||||||
tracing::warn!("Failed to write mcl-shim.jar: {e}");
|
tracing::warn!("Failed to write rmcl-shim.jar: {e}");
|
||||||
}
|
}
|
||||||
dest
|
dest
|
||||||
}
|
}
|
||||||
@@ -237,7 +237,7 @@ fn add_lwjgl3(lib_dir: &Path, classpath: &mut Vec<PathBuf>) {
|
|||||||
// recursion on java 24+. the config is written to .minecraft/ and
|
// recursion on java 24+. the config is written to .minecraft/ and
|
||||||
// pointed to via -Dlog4j.configurationFile.
|
// pointed to via -Dlog4j.configurationFile.
|
||||||
fn write_log4j_config(minecraft_dir: &Path, jvm_args: &mut Vec<String>) {
|
fn write_log4j_config(minecraft_dir: &Path, jvm_args: &mut Vec<String>) {
|
||||||
let config_path = minecraft_dir.join(".mcl-log4j2.xml");
|
let config_path = minecraft_dir.join(".rmcl-log4j2.xml");
|
||||||
let config = r#"<?xml version="1.0" encoding="UTF-8"?>
|
let config = r#"<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Configuration status="WARN">
|
<Configuration status="WARN">
|
||||||
<Appenders>
|
<Appenders>
|
||||||
|
|||||||
@@ -148,8 +148,8 @@ mod tests {
|
|||||||
async fn test_vanilla_install_noop() {
|
async fn test_vanilla_install_noop() {
|
||||||
let client = HttpClient::new();
|
let client = HttpClient::new();
|
||||||
let installer = VanillaInstaller;
|
let installer = VanillaInstaller;
|
||||||
let tmp = std::env::temp_dir().join("mcl_test_vanilla_install");
|
let tmp = std::env::temp_dir().join("rmcl_test_vanilla_install");
|
||||||
let meta = std::env::temp_dir().join("mcl_test_meta");
|
let meta = std::env::temp_dir().join("rmcl_test_meta");
|
||||||
installer
|
installer
|
||||||
.install(&client, "1.20.1", "vanilla", &tmp, &meta)
|
.install(&client, "1.20.1", "vanilla", &tmp, &meta)
|
||||||
.await
|
.await
|
||||||
|
|||||||
@@ -319,8 +319,8 @@ mod tests {
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
fn test_manager() -> (InstanceManager, PathBuf) {
|
fn test_manager() -> (InstanceManager, PathBuf) {
|
||||||
let tmp = std::env::temp_dir().join(format!("mcl_test_{}", uuid_like()));
|
let tmp = std::env::temp_dir().join(format!("rmcl_test_{}", uuid_like()));
|
||||||
let meta = std::env::temp_dir().join(format!("mcl_meta_test_{}", uuid_like()));
|
let meta = std::env::temp_dir().join(format!("rmcl_meta_test_{}", uuid_like()));
|
||||||
std::fs::create_dir_all(&tmp).ok();
|
std::fs::create_dir_all(&tmp).ok();
|
||||||
std::fs::create_dir_all(&meta).ok();
|
std::fs::create_dir_all(&meta).ok();
|
||||||
(InstanceManager::new(tmp.clone(), meta), tmp)
|
(InstanceManager::new(tmp.clone(), meta), tmp)
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ pub mod tui;
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
|
// Run before logging::init() so the cache rename isn't blocked by a
|
||||||
|
// freshly-created ~/.cache/rmcl/ directory.
|
||||||
|
migrate::run_legacy_rename();
|
||||||
|
|
||||||
// Guard must stay in scope to keep the log file writer alive
|
// Guard must stay in scope to keep the log file writer alive
|
||||||
let _guard = tui::logging::init();
|
let _guard = tui::logging::init();
|
||||||
if let Err(e) = color_eyre::install() {
|
if let Err(e) = color_eyre::install() {
|
||||||
|
|||||||
+2
-1
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::Path;
|
||||||
|
|
||||||
const OLD_NAME: &str = "mcl";
|
const OLD_NAME: &str = "mcl";
|
||||||
const NEW_NAME: &str = "rmcl";
|
const NEW_NAME: &str = "rmcl";
|
||||||
@@ -171,6 +171,7 @@ fn sanitize(name: &str) -> String {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use std::path::PathBuf;
|
||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
use std::sync::atomic::{AtomicU64, Ordering};
|
||||||
|
|
||||||
static COUNTER: AtomicU64 = AtomicU64::new(0);
|
static COUNTER: AtomicU64 = AtomicU64::new(0);
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ impl HttpClient {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let client = Client::builder()
|
let client = Client::builder()
|
||||||
.user_agent(format!(
|
.user_agent(format!(
|
||||||
"mcl/{} (Minecraft Launcher)",
|
"rmcl/{} (Minecraft Launcher)",
|
||||||
env!("CARGO_PKG_VERSION")
|
env!("CARGO_PKG_VERSION")
|
||||||
))
|
))
|
||||||
.timeout(std::time::Duration::from_secs(30))
|
.timeout(std::time::Duration::from_secs(30))
|
||||||
|
|||||||
+2
-2
@@ -40,7 +40,7 @@ fn push_app_log(line: String) {
|
|||||||
// before you remember this. ask me how i know.
|
// before you remember this. ask me how i know.
|
||||||
pub fn init() -> WorkerGuard {
|
pub fn init() -> WorkerGuard {
|
||||||
let log_dir = match dirs_next::cache_dir() {
|
let log_dir = match dirs_next::cache_dir() {
|
||||||
Some(d) => d.join("mcl"),
|
Some(d) => d.join("rmcl"),
|
||||||
None => std::path::PathBuf::from("./cache"),
|
None => std::path::PathBuf::from("./cache"),
|
||||||
};
|
};
|
||||||
match std::fs::create_dir_all(&log_dir) {
|
match std::fs::create_dir_all(&log_dir) {
|
||||||
@@ -55,7 +55,7 @@ pub fn init() -> WorkerGuard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let now = chrono::Local::now().format("%Y-%m-%d_%H-%M-%S");
|
let now = chrono::Local::now().format("%Y-%m-%d_%H-%M-%S");
|
||||||
let file_appender = tracing_appender::rolling::never(&log_dir, format!("mcl_{now}.log"));
|
let file_appender = tracing_appender::rolling::never(&log_dir, format!("rmcl_{now}.log"));
|
||||||
let (non_blocking, guard) = tracing_appender::non_blocking(file_appender);
|
let (non_blocking, guard) = tracing_appender::non_blocking(file_appender);
|
||||||
|
|
||||||
let env_filter = EnvFilter::builder()
|
let env_filter = EnvFilter::builder()
|
||||||
|
|||||||
Reference in new issue
Block a user