added download location to root_config
This commit is contained in:
@@ -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<PathBuf>,
|
||||
|
||||
nexus_api_key: Option<String>,
|
||||
|
||||
#[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)]
|
||||
|
||||
Reference in New Issue
Block a user