mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2026-03-21 21:58:52 +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 {
|
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");
|
let wine_prefix = self.path.parent().unwrap().join("data");
|
||||||
if !wine_prefix.exists() {
|
if !wine_prefix.exists() {
|
||||||
create_dir(wine_prefix.clone()).unwrap()
|
create_dir(wine_prefix.clone()).unwrap()
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
use std::{
|
use std::{
|
||||||
fs::{create_dir, remove_file, rename, File},
|
fs::{create_dir, remove_file, rename, File},
|
||||||
|
io::{BufRead, BufReader},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
time::Duration,
|
time::Duration,
|
||||||
@ -145,10 +146,19 @@ impl GameManager {
|
|||||||
|
|
||||||
pub async fn start_game(wine: &Wine, game_dir: PathBuf) {
|
pub async fn start_game(wine: &Wine, game_dir: PathBuf) {
|
||||||
debug!("Wine version : {:?}", wine.version().unwrap());
|
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 {
|
tokio::task::spawn_blocking(move || {
|
||||||
sleep(Duration::from_millis(10000)).await;
|
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