Fixed ability to use system wine to run the game

This commit is contained in:
Observer KRypt0n_ 2022-08-28 17:05:02 +02:00
parent f66624d40d
commit c1af50b8c1
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
2 changed files with 9 additions and 7 deletions

View file

@ -43,15 +43,13 @@ impl LauncherState {
pub fn get<T: Fn(&str)>(status: T) -> std::io::Result<Self> {
let config = config::get()?;
// Check wine existance
if config.game.wine.selected == None {
// Check wine existence
if let None = config.try_get_wine_executable() {
return Ok(Self::WineNotInstalled);
}
// Check prefix existance
let prefix = WinePrefix::new(&config.game.wine.prefix);
if !prefix.exists() {
// Check prefix existence
if !WinePrefix::exists_in(&config.game.wine.prefix) {
return Ok(Self::PrefixNotExists);
}

View file

@ -12,7 +12,11 @@ impl WinePrefix {
}
pub fn exists(&self) -> bool {
Path::new(&format!("{}/drive_c", self.path)).exists()
Self::exists_in(&self.path)
}
pub fn exists_in<T: ToString>(path: T) -> bool {
Path::new(&format!("{}/drive_c", path.to_string())).exists()
}
fn wine<T: ToString>(&self, runners_folder: T, runner: super::wine::Version, command: &str) -> std::io::Result<Output> {