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
+1
-1
@@ -93,7 +93,7 @@ mod tests {
|
||||
|
||||
fn unique_temp_dir() -> std::path::PathBuf {
|
||||
std::env::temp_dir().join(format!(
|
||||
"mcl_cli_log_test_{}",
|
||||
"rmcl_cli_log_test_{}",
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.expect("time should work")
|
||||
|
||||
+3
-3
@@ -14,7 +14,7 @@ use clap::{Arg, ArgAction, ArgGroup, Command};
|
||||
pub async fn init() {
|
||||
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() {
|
||||
// force-init the theme so it's ready before the TUI renders
|
||||
let _ = &*crate::config::theme::THEME;
|
||||
@@ -43,7 +43,7 @@ pub async fn init() {
|
||||
}
|
||||
|
||||
fn build_command() -> Command {
|
||||
Command::new("mcl")
|
||||
Command::new("rmcl")
|
||||
.about("Minecraft CLI Launcher")
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.subcommand_required(false)
|
||||
@@ -245,7 +245,7 @@ mod tests {
|
||||
#[test]
|
||||
fn parses_instance_list_subcommand() {
|
||||
let matches = build_command()
|
||||
.try_get_matches_from(["mcl", "instance", "list"])
|
||||
.try_get_matches_from(["rmcl", "instance", "list"])
|
||||
.expect("command should parse");
|
||||
assert!(matches.subcommand_matches("instance").is_some());
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ pub use settings::Config;
|
||||
pub fn get_config_path() -> PathBuf {
|
||||
dirs_next::config_dir()
|
||||
.unwrap_or_else(|| PathBuf::from("."))
|
||||
.join("mcl")
|
||||
.join("rmcl")
|
||||
}
|
||||
|
||||
// seeds the config file from the bundled default on first run
|
||||
|
||||
@@ -21,7 +21,7 @@ pub struct Paths {
|
||||
fn default_instances_dir() -> String {
|
||||
dirs_next::data_dir()
|
||||
.unwrap_or_else(|| PathBuf::from("."))
|
||||
.join("mcl")
|
||||
.join("rmcl")
|
||||
.join("instances")
|
||||
.to_string_lossy()
|
||||
.into_owned()
|
||||
@@ -30,7 +30,7 @@ fn default_instances_dir() -> String {
|
||||
fn default_meta_dir() -> String {
|
||||
dirs_next::data_dir()
|
||||
.unwrap_or_else(|| PathBuf::from("."))
|
||||
.join("mcl")
|
||||
.join("rmcl")
|
||||
.join("meta")
|
||||
.to_string_lossy()
|
||||
.into_owned()
|
||||
@@ -181,14 +181,14 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
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]
|
||||
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().ends_with("games/mcl"));
|
||||
assert!(resolved.to_string_lossy().ends_with("games/rmcl"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -200,22 +200,22 @@ mod tests {
|
||||
#[test]
|
||||
fn resolve_instances_dir_absolute() {
|
||||
let paths = Paths {
|
||||
instances_dir: "/opt/mcl/instances".to_owned(),
|
||||
instances_dir: "/opt/rmcl/instances".to_owned(),
|
||||
..Paths::default()
|
||||
};
|
||||
assert_eq!(
|
||||
paths.resolve_instances_dir(),
|
||||
PathBuf::from("/opt/mcl/instances")
|
||||
PathBuf::from("/opt/rmcl/instances")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_meta_dir_absolute() {
|
||||
let paths = Paths {
|
||||
meta_dir: "/opt/mcl/meta".to_owned(),
|
||||
meta_dir: "/opt/rmcl/meta".to_owned(),
|
||||
..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]
|
||||
|
||||
@@ -14,7 +14,7 @@ pub fn desktop_path(name: &str) -> Option<PathBuf> {
|
||||
{
|
||||
dirs_next::data_dir().map(|d| {
|
||||
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> {
|
||||
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
|
||||
@@ -145,7 +145,7 @@ fn build_linux_desktop(name: &str, icon: Option<&Path>) -> String {
|
||||
out.push_str("Type=Application\n");
|
||||
out.push_str(&format!("Name=Minecraft - {name}\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 {
|
||||
out.push_str(&format!("Icon={}\n", icon.display()));
|
||||
}
|
||||
@@ -159,7 +159,7 @@ fn build_windows_shortcut(name: &str) -> String {
|
||||
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!("mcl instance launch \"{name}\"\r\n"));
|
||||
out.push_str(&format!("rmcl instance launch \"{name}\"\r\n"));
|
||||
out.push_str("pause\r\n");
|
||||
out
|
||||
}
|
||||
@@ -169,7 +169,7 @@ fn build_macos_command(name: &str) -> String {
|
||||
let mut out = String::new();
|
||||
out.push_str("#!/bin/bash\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
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ mod tests {
|
||||
fn build_content_linux() {
|
||||
let content = build_content("TestPack", None);
|
||||
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("Categories=Game;"));
|
||||
}
|
||||
|
||||
@@ -83,17 +83,17 @@ pub async fn apply(
|
||||
|
||||
Some(LwjglifyPatches {
|
||||
jvm_args,
|
||||
main_class: "MclShim".to_string(),
|
||||
main_class: "RmclShim".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 {
|
||||
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) {
|
||||
tracing::warn!("Failed to write mcl-shim.jar: {e}");
|
||||
tracing::warn!("Failed to write rmcl-shim.jar: {e}");
|
||||
}
|
||||
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
|
||||
// pointed to via -Dlog4j.configurationFile.
|
||||
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"?>
|
||||
<Configuration status="WARN">
|
||||
<Appenders>
|
||||
|
||||
@@ -148,8 +148,8 @@ mod tests {
|
||||
async fn test_vanilla_install_noop() {
|
||||
let client = HttpClient::new();
|
||||
let installer = VanillaInstaller;
|
||||
let tmp = std::env::temp_dir().join("mcl_test_vanilla_install");
|
||||
let meta = std::env::temp_dir().join("mcl_test_meta");
|
||||
let tmp = std::env::temp_dir().join("rmcl_test_vanilla_install");
|
||||
let meta = std::env::temp_dir().join("rmcl_test_meta");
|
||||
installer
|
||||
.install(&client, "1.20.1", "vanilla", &tmp, &meta)
|
||||
.await
|
||||
|
||||
@@ -319,8 +319,8 @@ mod tests {
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn test_manager() -> (InstanceManager, PathBuf) {
|
||||
let tmp = std::env::temp_dir().join(format!("mcl_test_{}", uuid_like()));
|
||||
let meta = std::env::temp_dir().join(format!("mcl_meta_test_{}", uuid_like()));
|
||||
let tmp = std::env::temp_dir().join(format!("rmcl_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(&meta).ok();
|
||||
(InstanceManager::new(tmp.clone(), meta), tmp)
|
||||
|
||||
@@ -10,6 +10,10 @@ pub mod tui;
|
||||
|
||||
#[tokio::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
|
||||
let _guard = tui::logging::init();
|
||||
if let Err(e) = color_eyre::install() {
|
||||
|
||||
+2
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
use std::fs;
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::path::Path;
|
||||
|
||||
const OLD_NAME: &str = "mcl";
|
||||
const NEW_NAME: &str = "rmcl";
|
||||
@@ -171,6 +171,7 @@ fn sanitize(name: &str) -> String {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
|
||||
static COUNTER: AtomicU64 = AtomicU64::new(0);
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ impl HttpClient {
|
||||
pub fn new() -> Self {
|
||||
let client = Client::builder()
|
||||
.user_agent(format!(
|
||||
"mcl/{} (Minecraft Launcher)",
|
||||
"rmcl/{} (Minecraft Launcher)",
|
||||
env!("CARGO_PKG_VERSION")
|
||||
))
|
||||
.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.
|
||||
pub fn init() -> WorkerGuard {
|
||||
let log_dir = match dirs_next::cache_dir() {
|
||||
Some(d) => d.join("mcl"),
|
||||
Some(d) => d.join("rmcl"),
|
||||
None => std::path::PathBuf::from("./cache"),
|
||||
};
|
||||
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 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 env_filter = EnvFilter::builder()
|
||||
|
||||
Reference in new issue
Block a user