Fix Nexusmods API key not being loaded from config

This commit is contained in:
Lucas Schwiderski 2023-11-14 15:07:07 +01:00 committed by Lucas Schwiderski
parent 3af631348d
commit 6c94723995
3 changed files with 13 additions and 1 deletions

View file

@ -384,7 +384,10 @@ pub(crate) async fn import_mod(state: ActionState, info: FileInfo) -> Result<Mod
.mods_id(id)
.await
.wrap_err_with(|| format!("Failed to query mod {} from Nexus", id))?;
Some(NexusInfo::from(mod_info))
let info = NexusInfo::from(mod_info);
tracing::debug!("{:?}", info);
Some(info)
} else {
None
}

View file

@ -411,6 +411,7 @@ impl AppDelegate<State> for Delegate {
state.config_path = Arc::new(config.path);
state.data_dir = Arc::new(config.data_dir);
state.game_dir = Arc::new(config.game_dir.unwrap_or_default());
state.nexus_api_key = Arc::new(config.nexus_api_key.unwrap_or_default());
state.is_io_enabled = config.unsafe_io;
}

View file

@ -125,6 +125,9 @@ where
.wrap_err_with(|| format!("Invalid config file {}", path.display()))?;
cfg.path = path;
tracing::debug!("Read config file '{}': {:?}", cfg.path.display(), cfg);
Ok(cfg)
}
Err(err) if err.kind() == ErrorKind::NotFound => {
@ -133,6 +136,11 @@ where
.wrap_err_with(|| format!("Failed to read config file {}", path.display()))?;
}
tracing::debug!(
"Config file not found at '{}', creating default.",
path.display()
);
{
let parent = default_path
.parent()