diff --git a/src/fabric.rs b/src/fabric.rs index 1495e93..c1faf5a 100644 --- a/src/fabric.rs +++ b/src/fabric.rs @@ -60,7 +60,9 @@ pub fn install_fabric(minecraft_path: &Path, minecraft_version: &str, loader_ver let profile_json = profile_dir.join(format!("{profile_name}.json")); let libs_dir = minecraft_path.join("libraries"); - let json = query_meta_json(&format!("v2/versions/loader/{minecraft_version}/{loader_version}/profile/json")); + let mut json = query_meta_json(&format!("v2/versions/loader/{minecraft_version}/{loader_version}/profile/json")); + + *json.get_mut("id").unwrap() = Value::String(profile_name.clone()); fs::create_dir_all(&profile_dir).unwrap(); diff --git a/src/lib.rs b/src/lib.rs index 1dc96c9..e59f413 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,3 +34,10 @@ pub fn launch_version(version: &str) { ) .unwrap() } + +pub fn install_fabric(version: &str, loader: &str) { + let base_path = PathBuf::from(std::env::home_dir().unwrap()).join(".saturn-launcher"); + let instances_path = base_path.join("instances"); + let instance = instances_path.join(version); + fabric::install_fabric(&instance, version, loader).unwrap() +} diff --git a/src/main.rs b/src/main.rs index a1cd01f..8a2b59e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,14 +1,5 @@ -use std::path::PathBuf; - fn main() { - // download_version("1.21.4"); + // smallauncher_lib::download_version("1.21.4"); + // smallauncher_lib::install_fabric("1.21.4", "0.17.2"); smallauncher_lib::launch_version("1.21.4"); - // install_fabric("1.21.4", "0.17.2"); -} - -fn install_fabric(version: &str, loader: &str) { - let base_path = PathBuf::from(std::env::home_dir().unwrap()).join(".saturn-launcher"); - let instances_path = base_path.join("instances"); - let instance = instances_path.join(version); - smallauncher_lib::fabric::install_fabric(&instance, version, loader).unwrap() }