diff --git a/Cargo.lock b/Cargo.lock index 9bf47f8..0548a6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3710,6 +3710,7 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ + "indexmap", "serde", "serde_spanned", "toml_datetime", diff --git a/mcmpmgr/Cargo.toml b/mcmpmgr/Cargo.toml index cec2b87..79685d2 100644 --- a/mcmpmgr/Cargo.toml +++ b/mcmpmgr/Cargo.toml @@ -16,4 +16,4 @@ serde = { version = "1.0.207", features = ["derive"] } sha2 = "0.10.8" tempfile = "3.12.0" tokio = { version = "1.39.2", features = ["full"] } -toml = "0.8.19" +toml = { version = "0.8.19", features = ["preserve_order"] } diff --git a/mcmpmgr/src/modpack.rs b/mcmpmgr/src/modpack.rs index ebe3518..1e3f327 100644 --- a/mcmpmgr/src/modpack.rs +++ b/mcmpmgr/src/modpack.rs @@ -2,7 +2,7 @@ use crate::mod_meta::{ModMeta, ModProvider}; use anyhow::Result; use serde::{Deserialize, Serialize}; use std::{ - collections::{HashMap, HashSet}, + collections::{BTreeMap, HashSet}, path::{Path, PathBuf}, }; @@ -41,7 +41,7 @@ pub struct ModpackMeta { pub pack_name: String, pub mc_version: String, pub modloader: ModLoader, - pub mods: HashMap, + pub mods: BTreeMap, pub default_providers: Vec, pub forbidden_mods: HashSet, } @@ -56,7 +56,7 @@ impl ModpackMeta { } } - pub fn iter_mods(&self) -> std::collections::hash_map::Values { + pub fn iter_mods(&self) -> std::collections::btree_map::Values { self.mods.values().into_iter() } diff --git a/mcmpmgr/src/profiles.rs b/mcmpmgr/src/profiles.rs index 1e0ae92..6296e51 100644 --- a/mcmpmgr/src/profiles.rs +++ b/mcmpmgr/src/profiles.rs @@ -1,8 +1,7 @@ use anyhow::Result; use serde::{Deserialize, Serialize}; use std::{ - collections::HashMap, - error::Error, + collections::BTreeMap, fmt::Display, path::{Path, PathBuf}, str::FromStr, @@ -80,7 +79,7 @@ impl Profile { /// User data and configs for the modpack manager #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Data { - profiles: HashMap, + profiles: BTreeMap, } impl Default for Data { diff --git a/mcmpmgr/src/resolver.rs b/mcmpmgr/src/resolver.rs index 108e7f5..6897a79 100644 --- a/mcmpmgr/src/resolver.rs +++ b/mcmpmgr/src/resolver.rs @@ -2,8 +2,7 @@ use anyhow::Result; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha512}; use std::{ - collections::{HashMap, HashSet}, - error::Error, + collections::{BTreeMap, HashSet}, ffi::{OsStr, OsString}, path::{Path, PathBuf}, }; @@ -18,7 +17,7 @@ const MODPACK_LOCK_FILENAME: &str = "modpack.lock"; #[derive(Serialize, Deserialize)] pub struct PinnedPackMeta { - mods: HashMap, + mods: BTreeMap, #[serde(skip_serializing, skip_deserializing)] modrinth: Modrinth, }