mirror of
https://github.com/an-anime-team/sleepy-launcher.git
synced 2024-11-25 14:20:08 +03:00
feat(core): added LauncherState::PrefixNotExists
state support
Taught launcher how to create wine prefixes
This commit is contained in:
parent
0e07cb0698
commit
1755faaab1
3 changed files with 35 additions and 1 deletions
|
@ -4,6 +4,7 @@ config-file-opening-error = Failed to open config file
|
|||
debug-file-opening-error = Failed to open debug file
|
||||
|
||||
game-launching-failed = Failed to launch game
|
||||
failed-get-selected-wine = Failed to get selected wine version
|
||||
|
||||
background-downloading-failed = Failed to download background picture
|
||||
config-update-error = Failed to save config
|
||||
|
|
|
@ -4,6 +4,7 @@ config-file-opening-error = Не удалось открыть файл наст
|
|||
debug-file-opening-error = Не удалось открыть файл отладки
|
||||
|
||||
game-launching-failed = Не удалось запустить игру
|
||||
failed-get-selected-wine = Не удалось найти выбранную версию Wine
|
||||
|
||||
background-downloading-failed = Не удалось загрузить фоновое изображение
|
||||
config-update-error = Ошибка сохранения настроек
|
||||
|
|
|
@ -12,6 +12,7 @@ use gtk::glib::clone;
|
|||
|
||||
use anime_launcher_sdk::config::launcher::LauncherStyle;
|
||||
use anime_launcher_sdk::states::LauncherState;
|
||||
use anime_launcher_sdk::wincompatlib::prelude::*;
|
||||
|
||||
use crate::*;
|
||||
use crate::i18n::*;
|
||||
|
@ -679,7 +680,38 @@ impl SimpleComponent for App {
|
|||
}
|
||||
|
||||
LauncherState::WineNotInstalled => todo!(),
|
||||
LauncherState::PrefixNotExists => todo!(),
|
||||
|
||||
LauncherState::PrefixNotExists => {
|
||||
let config = config::get().unwrap();
|
||||
|
||||
match config.try_get_wine_executable() {
|
||||
Some(wine) => {
|
||||
sender.input(AppMsg::DisableButtons(true));
|
||||
|
||||
std::thread::spawn(move || {
|
||||
let wine = Wine::from_binary(wine)
|
||||
.with_loader(WineLoader::Current)
|
||||
.with_arch(WineArch::Win64);
|
||||
|
||||
if let Err(err) = wine.update_prefix(&config.game.wine.prefix) {
|
||||
sender.input(AppMsg::Toast {
|
||||
title: tr("wine-prefix-update-failed"),
|
||||
description: Some(err.to_string())
|
||||
});
|
||||
}
|
||||
|
||||
sender.input(AppMsg::DisableButtons(true));
|
||||
sender.input(AppMsg::UpdateLauncherState);
|
||||
});
|
||||
}
|
||||
|
||||
None => sender.input(AppMsg::Toast {
|
||||
title: tr("failed-get-selected-wine"),
|
||||
description: None
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
LauncherState::VoiceUpdateAvailable(_) => todo!(),
|
||||
LauncherState::VoiceOutdated(_) => todo!(),
|
||||
LauncherState::VoiceNotInstalled(_) => todo!(),
|
||||
|
|
Loading…
Reference in a new issue