diff options
| author | 2026-01-15 18:17:45 +0800 | |
|---|---|---|
| committer | 2026-01-15 18:17:45 +0800 | |
| commit | 20cd97d8b3af67050fbe7b5f8d6d5fb1c1f3237b (patch) | |
| tree | f90db0c71e713d5a176ef256dd145d6a17b04867 /src-tauri/src/core | |
| parent | aaa81ccb05362333e512b2609e9d86f11f5457eb (diff) | |
| download | DropOut-20cd97d8b3af67050fbe7b5f8d6d5fb1c1f3237b.tar.gz DropOut-20cd97d8b3af67050fbe7b5f8d6d5fb1c1f3237b.zip | |
feat: Add version installation and check functionality to enhance mod loader support in the application
Diffstat (limited to 'src-tauri/src/core')
| -rw-r--r-- | src-tauri/src/core/fabric.rs | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src-tauri/src/core/fabric.rs b/src-tauri/src/core/fabric.rs index fd38f41..3e4d50d 100644 --- a/src-tauri/src/core/fabric.rs +++ b/src-tauri/src/core/fabric.rs @@ -63,10 +63,31 @@ pub struct FabricLibrary { } /// Main class configuration for Fabric. +/// Can be either a struct with client/server fields or a simple string. #[derive(Debug, Deserialize, Serialize, Clone)] -pub struct FabricMainClass { - pub client: String, - pub server: String, +#[serde(untagged)] +pub enum FabricMainClass { + Structured { + client: String, + server: String, + }, + Simple(String), +} + +impl FabricMainClass { + pub fn client(&self) -> &str { + match self { + FabricMainClass::Structured { client, .. } => client, + FabricMainClass::Simple(s) => s, + } + } + + pub fn server(&self) -> &str { + match self { + FabricMainClass::Structured { server, .. } => server, + FabricMainClass::Simple(s) => s, + } + } } /// Represents a Minecraft version supported by Fabric. |