Skip to content

Commit 707a170

Browse files
committed
Auto-configure wine path on MacOS
1 parent 2586edf commit 707a170

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src-tauri/src/util.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,33 @@ fn find_proton() -> Option<PathBuf> {
157157
candidates.first().map(|(path, _)| path.clone())
158158
}
159159

160+
fn find_macos_wine() -> Option<PathBuf> {
161+
const CANDIDATES: [&str; 5] = [
162+
"/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/CrossOver-Hosted Application/wineloader",
163+
"/Applications/Wine Crossover.app/Contents/Resources/wine/bin/wine",
164+
"/Applications/Wine Stable.app/Contents/Resources/wine/bin/wine",
165+
"/Applications/Wine Devel.app/Contents/Resources/wine/bin/wine",
166+
"/Applications/Wine Staging.app/Contents/Resources/wine/bin/wine"
167+
];
168+
169+
for p in &CANDIDATES {
170+
let path = PathBuf::from(p);
171+
if path.exists() {
172+
return Some(path);
173+
}
174+
}
175+
None
176+
}
177+
160178
pub(crate) fn get_default_launch_command() -> Option<String> {
161179
if cfg!(target_os = "windows") {
162180
None
181+
} else if cfg!(target_os = "macos") {
182+
if let Some(wine_path) = find_macos_wine() {
183+
Some(format!("\"{}\" {{}}", wine_path.to_string_lossy()))
184+
} else {
185+
Some("wine {}".to_string())
186+
}
163187
} else if is_device_steam_deck() {
164188
let steam_compat_data_path = get_app_statics().compat_data_dir.clone();
165189
let steam_compat_client_install_path = get_steam_client_path()?;

0 commit comments

Comments
 (0)