Update dependencies #172
10 changed files with 613 additions and 527 deletions
1057
Cargo.lock
generated
1057
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -9,10 +9,10 @@ members = [
|
||||||
"lib/serde_sjson",
|
"lib/serde_sjson",
|
||||||
"lib/luajit2-sys",
|
"lib/luajit2-sys",
|
||||||
]
|
]
|
||||||
|
exclude = ["lib/color-eyre"]
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
color-eyre = { path = "lib/color-eyre" }
|
color-eyre = { path = "lib/color-eyre" }
|
||||||
ansi-parser = { path = "lib/ansi-parser" }
|
|
||||||
|
|
||||||
[profile.dev.package.backtrace]
|
[profile.dev.package.backtrace]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
|
|
|
@ -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,6 +1,5 @@
|
||||||
#![recursion_limit = "256"]
|
#![recursion_limit = "256"]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
#![feature(arc_unwrap_or_clone)]
|
|
||||||
#![feature(iterator_try_collect)]
|
#![feature(iterator_try_collect)]
|
||||||
#![windows_subsystem = "windows"]
|
#![windows_subsystem = "windows"]
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ impl Lens<State, Option<Arc<ModInfo>>> for SelectedModLens {
|
||||||
/// A Lens that maps an `im::Vector<T>` to `im::Vector<(usize, T)>`,
|
/// A Lens that maps an `im::Vector<T>` to `im::Vector<(usize, T)>`,
|
||||||
/// where each element in the destination vector includes its index in the
|
/// where each element in the destination vector includes its index in the
|
||||||
/// source vector.
|
/// source vector.
|
||||||
|
#[allow(dead_code)]
|
||||||
pub(crate) struct IndexedVectorLens;
|
pub(crate) struct IndexedVectorLens;
|
||||||
|
|
||||||
impl<T: Data> Lens<Vector<T>, Vector<(usize, T)>> for IndexedVectorLens {
|
impl<T: Data> Lens<Vector<T>, Vector<(usize, T)>> for IndexedVectorLens {
|
||||||
|
|
|
@ -69,23 +69,10 @@ pub mod gruvbox_dark {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ColorExt {
|
pub trait ColorExt {
|
||||||
fn lighten(&self, fac: f32) -> Self;
|
|
||||||
fn darken(&self, fac: f32) -> Self;
|
fn darken(&self, fac: f32) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ColorExt for Color {
|
impl ColorExt for Color {
|
||||||
fn lighten(&self, fac: f32) -> Self {
|
|
||||||
let (r, g, b, a) = self.as_rgba();
|
|
||||||
let rgb = Rgb::from(r as f32, g as f32, b as f32);
|
|
||||||
let rgb = rgb.lighten(fac);
|
|
||||||
Self::rgba(
|
|
||||||
rgb.get_red() as f64,
|
|
||||||
rgb.get_green() as f64,
|
|
||||||
rgb.get_blue() as f64,
|
|
||||||
a,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn darken(&self, fac: f32) -> Self {
|
fn darken(&self, fac: f32) -> Self {
|
||||||
let (r, g, b, a) = self.as_rgba();
|
let (r, g, b, a) = self.as_rgba();
|
||||||
let rgb = Rgb::from(r as f32, g as f32, b as f32);
|
let rgb = Rgb::from(r as f32, g as f32, b as f32);
|
||||||
|
|
|
@ -2,16 +2,11 @@ use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use druid::text::Formatter;
|
use druid::text::Formatter;
|
||||||
use druid::{Data, Widget};
|
|
||||||
|
|
||||||
pub mod border;
|
pub mod border;
|
||||||
pub mod button;
|
pub mod button;
|
||||||
pub mod controller;
|
pub mod controller;
|
||||||
|
|
||||||
pub trait ExtraWidgetExt<T: Data>: Widget<T> + Sized + 'static {}
|
|
||||||
|
|
||||||
impl<T: Data, W: Widget<T> + 'static> ExtraWidgetExt<T> for W {}
|
|
||||||
|
|
||||||
pub(crate) struct PathBufFormatter;
|
pub(crate) struct PathBufFormatter;
|
||||||
|
|
||||||
impl PathBufFormatter {
|
impl PathBufFormatter {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0fa05eba9954be223b06468c8760b97e660f9941
|
Subproject commit b40962a61c748756d7da293d9fff26aca019603e
|
|
@ -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