From 0b49999bc3a3f6af79006c2e2b2cdf8dd09c31ed Mon Sep 17 00:00:00 2001 From: Niklas Kapelle Date: Mon, 9 Mar 2026 22:11:23 +0100 Subject: [PATCH] added download location to root_config --- src/types/root_config.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/types/root_config.rs b/src/types/root_config.rs index 843649f..0ff2217 100644 --- a/src/types/root_config.rs +++ b/src/types/root_config.rs @@ -5,7 +5,6 @@ use std::{ }; use log::debug; -use quick_xml::se; use serde::Deserialize; use crate::types::{ConfigReadWriteError, ModConfig, game::Game, modded_instance::ModdedInstance}; @@ -19,6 +18,8 @@ pub struct RootConfig { /// Where all mods are stored mod_location: PathBuf, + download_location: Option, + nexus_api_key: Option, #[serde(default)] @@ -48,6 +49,12 @@ impl RootConfig { config.mod_location = path.as_ref().join(config.mod_location).to_owned(); } + if let Some(dl_location) = &config.download_location + && dl_location.is_relative() + { + config.download_location = Some(path.as_ref().join(dl_location).to_owned()); + } + Ok(config) } @@ -79,6 +86,10 @@ impl RootConfig { pub fn nexus_api_key(&self) -> Option<&str> { self.nexus_api_key.as_deref() } + + pub fn download_location(&self) -> Option<&Path> { + self.download_location.as_deref() + } } #[derive(Debug, Clone, Deserialize)]