From 9df1ec77ef11552cd0df097a620d1e2e7092a5f2 Mon Sep 17 00:00:00 2001 From: Niklas Kapelle Date: Tue, 17 Mar 2026 14:26:43 +0100 Subject: [PATCH] game paths can now be relative & and get converted when requested --- src/activator.rs | 2 +- src/main.rs | 2 +- src/types/root_config.rs | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/activator.rs b/src/activator.rs index a99e831..4ebcb73 100644 --- a/src/activator.rs +++ b/src/activator.rs @@ -18,7 +18,7 @@ pub fn activate_instance( check_target_valid(&target)?; - let resolved_links = resolve_links(root_config, instance, game)?; + let resolved_links = resolve_links(root_config, instance, &game)?; resolved_links .iter() diff --git a/src/main.rs b/src/main.rs index 726b734..7e264ee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -71,7 +71,7 @@ fn command_order(root_config: &RootConfig, instance_id: &str) -> anyhow::Result< let mut instance = root_config.load_instance_by_id(instance_id)?; let game = root_config.game_by_id(instance.game_id()).unwrap(); - let new_load_order = load_order::create_loadorder(root_config, game, &instance)?; + let new_load_order = load_order::create_loadorder(root_config, &game, &instance)?; instance.set_load_order(new_load_order); diff --git a/src/types/root_config.rs b/src/types/root_config.rs index 2b58306..a42387b 100644 --- a/src/types/root_config.rs +++ b/src/types/root_config.rs @@ -63,8 +63,14 @@ impl RootConfig { Ok(()) } - pub fn game_by_id(&self, id: &str) -> Option<&Game> { - self.games.get(id) + pub fn game_by_id(&self, id: &str) -> Option { + self.games.get(id).map(|parsed_game| { + if parsed_game.install_location().is_relative() { + Game::new(self.self_parent.join(parsed_game.install_location())) + } else { + parsed_game.clone() + } + }) } pub fn mod_by_id(&self, id: &str) -> Option {