mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2025-12-15 17:08:51 +00:00
add wine cli output
This commit is contained in:
parent
d03a34b9c1
commit
e06b93e458
@ -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()
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user