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 {