Update dependencies #172
4 changed files with 608 additions and 506 deletions
1055
Cargo.lock
generated
1055
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -286,12 +286,18 @@ pub(crate) async fn load_initial(path: PathBuf, is_default: bool) -> Result<Init
|
||||||
|
|
||||||
let game_info = tokio::task::spawn_blocking(dtmt_shared::collect_game_info)
|
let game_info = tokio::task::spawn_blocking(dtmt_shared::collect_game_info)
|
||||||
.await
|
.await
|
||||||
.wrap_err("Failed to collect Steam game info")?;
|
.wrap_err("Failed to spawn task to collect Steam game info")?;
|
||||||
|
|
||||||
{
|
let game_info = match game_info {
|
||||||
if config.game_dir.is_none() && game_info.is_none() {
|
Ok(game_info) => game_info,
|
||||||
tracing::error!("No Game Directory set. Head to the 'Settings' tab to set it manually",);
|
Err(err) => {
|
||||||
|
tracing::error!("Failed to collect game info: {:?}", err);
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if config.game_dir.is_none() && game_info.is_none() {
|
||||||
|
tracing::error!("No Game Directory set. Head to the 'Settings' tab to set it manually",);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mod_dir = config.data_dir.join("mods");
|
let mod_dir = config.data_dir.join("mods");
|
||||||
|
|
|
@ -723,6 +723,14 @@ pub(crate) async fn deploy_mods(state: ActionState) -> Result<()> {
|
||||||
)
|
)
|
||||||
.wrap_err("Failed to gather deployment information")?;
|
.wrap_err("Failed to gather deployment information")?;
|
||||||
|
|
||||||
|
let game_info = match game_info {
|
||||||
|
Ok(game_info) => game_info,
|
||||||
|
Err(err) => {
|
||||||
|
tracing::error!("Failed to collect game info: {:#?}", err);
|
||||||
|
None
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
tracing::debug!(?game_info, ?deployment_info);
|
tracing::debug!(?game_info, ?deployment_info);
|
||||||
|
|
||||||
if let Some(game_info) = game_info {
|
if let Some(game_info) = game_info {
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
mod log;
|
use color_eyre::eyre::{OptionExt as _, WrapErr as _};
|
||||||
|
use color_eyre::Result;
|
||||||
pub use log::*;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use steamlocate::SteamDir;
|
use steamlocate::SteamDir;
|
||||||
use time::OffsetDateTime;
|
use time::OffsetDateTime;
|
||||||
|
|
||||||
|
pub use log::*;
|
||||||
|
|
||||||
|
mod log;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
pub struct ModConfigResources {
|
pub struct ModConfigResources {
|
||||||
pub init: PathBuf,
|
pub init: PathBuf,
|
||||||
|
@ -74,25 +77,23 @@ pub struct GameInfo {
|
||||||
pub last_updated: OffsetDateTime,
|
pub last_updated: OffsetDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn collect_game_info() -> Option<GameInfo> {
|
pub fn collect_game_info() -> Result<Option<GameInfo>> {
|
||||||
let mut dir = if let Some(dir) = SteamDir::locate() {
|
let dir = SteamDir::locate().wrap_err("Failed to locate Steam installation")?;
|
||||||
dir
|
|
||||||
} else {
|
|
||||||
tracing::debug!("Failed to locate Steam installation");
|
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
let found = dir
|
let found = dir
|
||||||
.app(&STEAMAPP_ID)
|
.find_app(STEAMAPP_ID)
|
||||||
.and_then(|app| app.last_updated.map(|v| (app.path.clone(), v)));
|
.wrap_err("Failed to look up game by Steam app ID")?;
|
||||||
|
|
||||||
let Some((path, last_updated)) = found else {
|
let Some((app, _)) = found else {
|
||||||
tracing::debug!("Found Steam, but failed to find game installation");
|
return Ok(None);
|
||||||
return None;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(GameInfo {
|
let last_updated = app
|
||||||
path,
|
.last_updated
|
||||||
|
.ok_or_eyre("Missing field 'last_updated'")?;
|
||||||
|
|
||||||
|
Ok(Some(GameInfo {
|
||||||
|
path: app.install_dir.into(),
|
||||||
last_updated: last_updated.into(),
|
last_updated: last_updated.into(),
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue