diff --git a/src/lib/launcher/states.rs b/src/lib/launcher/states.rs index 57e449f..b6bbd15 100644 --- a/src/lib/launcher/states.rs +++ b/src/lib/launcher/states.rs @@ -43,15 +43,13 @@ impl LauncherState { pub fn get(status: T) -> std::io::Result { 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); } diff --git a/src/lib/wine_prefix.rs b/src/lib/wine_prefix.rs index 9defcee..430f98d 100644 --- a/src/lib/wine_prefix.rs +++ b/src/lib/wine_prefix.rs @@ -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(path: T) -> bool { + Path::new(&format!("{}/drive_c", path.to_string())).exists() } fn wine(&self, runners_folder: T, runner: super::wine::Version, command: &str) -> std::io::Result {