add wine cli output

This commit is contained in:
ALEZ-DEV 2024-05-02 17:53:08 +02:00
parent d03a34b9c1
commit e06b93e458
2 changed files with 15 additions and 5 deletions

View File

@ -93,7 +93,7 @@ impl WineComponent {
}
pub fn init_wine(&self) -> wincompatlib::prelude::Wine {
let wine_path = self.path.join("bin/wine");
let wine_path = self.path.join("files/bin/wine64");
let wine_prefix = self.path.parent().unwrap().join("data");
if !wine_prefix.exists() {
create_dir(wine_prefix.clone()).unwrap()

View File

@ -1,5 +1,6 @@
use std::{
fs::{create_dir, remove_file, rename, File},
io::{BufRead, BufReader},
path::PathBuf,
sync::Arc,
time::Duration,
@ -145,10 +146,19 @@ impl GameManager {
pub async fn start_game(wine: &Wine, game_dir: PathBuf) {
debug!("Wine version : {:?}", wine.version().unwrap());
wine.run(game_dir.join("PGR.exe")).unwrap();
let mut child = wine.run(game_dir.join("PGR.exe")).unwrap();
loop {
sleep(Duration::from_millis(10000)).await;
}
tokio::task::spawn_blocking(move || {
let mut stdout = BufReader::new(child.stdout.as_mut().unwrap());
let mut line = String::new();
loop {
stdout.read_line(&mut line);
if !line.is_empty() {
debug!("{}", line);
}
}
})
.await;
}
}