feat(wuwa): removed fonts checking

This commit is contained in:
Nikita Podvirnyi 2024-06-28 17:06:25 +02:00
parent 8a00674501
commit 080ce25b3c
No known key found for this signature in database
GPG key ID: 859D416E5142AFF3

View file

@ -1,7 +1,5 @@
use std::path::PathBuf;
use wincompatlib::wine::ext::Font;
use anime_game_core::prelude::*;
use anime_game_core::wuwa::prelude::*;
@ -16,8 +14,6 @@ pub enum LauncherState {
PrefixNotExists,
FontsNotInstalled(Vec<Font>),
TelemetryNotDisabled,
// Always contains `VersionDiff::Diff`
@ -48,41 +44,12 @@ impl LauncherState {
pub fn get<F: Fn(StateUpdating)>(params: LauncherStateParams<F>) -> anyhow::Result<Self> {
tracing::debug!("Trying to get launcher state");
// Check prefix existence
if !params.wine_prefix.join("drive_c").exists() {
return Ok(Self::PrefixNotExists);
}
// Check wine components installation status
(params.status_updater)(StateUpdating::Components);
let mut fonts = Vec::new();
// In future, wincompatlib's Font might contain fonts that won't be actually needed
// That's why I listed only needed fonts here
const COREFONTS: &[Font] = &[
Font::Andale,
Font::Arial,
Font::Courier,
Font::Georgia,
Font::Impact,
Font::Times,
Font::Trebuchet,
Font::Verdana,
Font::Webdings,
// Who even needs it?
Font::ComicSans
];
for font in COREFONTS.iter().copied() {
if !font.is_installed(&params.wine_prefix) {
fonts.push(font);
}
}
if !fonts.is_empty() {
return Ok(Self::FontsNotInstalled(fonts));
// Check prefix existence
if !params.wine_prefix.join("drive_c").exists() {
return Ok(Self::PrefixNotExists);
}
// Check telemetry servers