From 0984ea5ef6f6c0d8c82067761ae7fee4375f8b84 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Sat, 25 Mar 2023 13:33:56 +0200 Subject: [PATCH] feat: made default `game.path` folder name depend on game edition --- .gitmodules | 0 Cargo.toml | 4 +++- src/config/game/mod.rs | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29..0000000 diff --git a/Cargo.toml b/Cargo.toml index 893e0c9..bd6dff0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,10 @@ git = "https://github.com/an-anime-team/anime-game-core" tag = "1.4.5" features = ["genshin", "all"] +# path = "../anime-game-core" # ! for dev purposes only + [dependencies] -anyhow = "1.0" +anyhow = { version = "1.0", features = ["backtrace"] } dirs = "5.0.0" tracing = "0.1" cached = { version = "0.42", features = ["proc_macro"] } diff --git a/src/config/game/mod.rs b/src/config/game/mod.rs index 46be86d..dd3ec19 100644 --- a/src/config/game/mod.rs +++ b/src/config/game/mod.rs @@ -4,6 +4,7 @@ use std::path::PathBuf; use serde::{Serialize, Deserialize}; use serde_json::Value as JsonValue; +use crate::anime_game_core::genshin::consts::{GameEdition, GAME_EDITION}; use crate::consts::launcher_dir; pub mod wine; @@ -36,7 +37,10 @@ impl Default for Game { let launcher_dir = launcher_dir().expect("Failed to get launcher dir"); Self { - path: launcher_dir.join("Genshin Impact"), // TODO: change it based on GameEdition + path: launcher_dir.join(match unsafe { GAME_EDITION } { + GameEdition::Global => concat!("Ge", "nshi", "n Imp", "act"), + GameEdition::China => concat!("Yu", "anS", "hen") + }), voices: vec![ String::from("en-us") ],