Skip to content

Commit 2ede63a

Browse files
Add preset for each macOS Wine install
1 parent 1240d67 commit 2ede63a

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src-tauri/src/util.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub(crate) fn get_default_offline_cache_dir() -> String {
105105
}
106106

107107
#[cfg(target_os = "macos")]
108-
fn find_macos_wine() -> Option<(String, PathBuf)> {
108+
fn find_macos_wine_installs() -> Vec<(String, PathBuf)> {
109109
const CANDIDATES: [&str; 5] = [
110110
"/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/CrossOver-Hosted Application/wineloader",
111111
"/Applications/Wine Crossover.app/Contents/Resources/wine/bin/wine",
@@ -114,6 +114,7 @@ fn find_macos_wine() -> Option<(String, PathBuf)> {
114114
"/Applications/Wine Staging.app/Contents/Resources/wine/bin/wine",
115115
];
116116

117+
let mut installs = Vec::new();
117118
for p in &CANDIDATES {
118119
let path = PathBuf::from(p);
119120
if path.exists() {
@@ -124,10 +125,10 @@ fn find_macos_wine() -> Option<(String, PathBuf)> {
124125
.unwrap()
125126
.trim_end_matches(".app")
126127
.to_string();
127-
return Some((app_name, path));
128+
installs.push((app_name, path));
128129
}
129130
}
130-
None
131+
installs
131132
}
132133

133134
/// Returns a list of preset launch profiles based on the OS and
@@ -144,9 +145,9 @@ pub(crate) fn get_preset_launch_profiles() -> Vec<LaunchProfile> {
144145
#[cfg(target_os = "macos")]
145146
{
146147
// Find Wine installs
147-
if let Some((app_name, app_path)) = find_macos_wine() {
148-
let macos_wine_cmd = format!("\"{}\" {{}}", app_path.to_string_lossy());
149-
profiles.push(LaunchProfile::new(&app_name, &macos_wine_cmd, true));
148+
for (app_name, wine_path) in find_macos_wine_installs() {
149+
let wine_cmd = format!("\"{}\" {{}}", wine_path.to_string_lossy());
150+
profiles.push(LaunchProfile::new(&app_name, &wine_cmd, true));
150151
}
151152
}
152153

0 commit comments

Comments
 (0)