Compare commits

..

2 Commits

4 changed files with 13 additions and 6 deletions

View File

@@ -18,7 +18,7 @@ pub fn activate_instance(
check_target_valid(&target)?; check_target_valid(&target)?;
let resolved_links = resolve_links(root_config, instance, game)?; let resolved_links = resolve_links(root_config, instance, &game)?;
resolved_links resolved_links
.iter() .iter()

View File

@@ -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 mut instance = root_config.load_instance_by_id(instance_id)?;
let game = root_config.game_by_id(instance.game_id()).unwrap(); 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); instance.set_load_order(new_load_order);

View File

@@ -1,4 +1,5 @@
use std::{ use std::{
collections::HashSet,
io, io,
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
@@ -20,8 +21,8 @@ impl Game {
} }
} }
pub fn export_links(&self) -> Result<Vec<Link>, io::Error> { pub fn export_links(&self) -> Result<HashSet<Link>, io::Error> {
let links: Vec<Link> = walk_all_files(&self.path)? let links: HashSet<Link> = walk_all_files(&self.path)?
.map(|entry| { .map(|entry| {
Link::new( Link::new(
entry.path(), entry.path(),

View File

@@ -63,8 +63,14 @@ impl RootConfig {
Ok(()) Ok(())
} }
pub fn game_by_id(&self, id: &str) -> Option<&Game> { pub fn game_by_id(&self, id: &str) -> Option<Game> {
self.games.get(id) 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<ModConfig> { pub fn mod_by_id(&self, id: &str) -> Option<ModConfig> {