Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve whisky discoverability on mac #3747

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 29 additions & 23 deletions src/backend/utils/compatibility_layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,29 +387,35 @@ export async function getWhisky(): Promise<Set<WineInstallation>> {
return whisky
}

await execAsync(
'mdfind kMDItemCFBundleIdentifier = "com.isaacmarovitz.Whisky"'
).then(async ({ stdout }) => {
stdout.split('\n').forEach((whiskyMacPath) => {
const infoFilePath = join(whiskyMacPath, 'Contents/Info.plist')
if (whiskyMacPath && existsSync(infoFilePath)) {
const info = plistParse(
readFileSync(infoFilePath, 'utf-8')
) as PlistObject
const version = info['CFBundleShortVersionString'] || ''
const whiskyWineBin = `${userHome}/Library/Application Support/com.isaacmarovitz.Whisky/Libraries/Wine/bin/wine64`

whisky.add({
bin: whiskyWineBin,
name: `Whisky - ${version}`,
type: `toolkit`,
lib: `${dirname(whiskyWineBin)}/../lib`,
lib32: `${dirname(whiskyWineBin)}/../lib`,
...getWineExecs(whiskyWineBin)
})
}
})
})
const whiskyWinePath = join(
userHome,
'Library/Application Support/com.isaacmarovitz.Whisky/Libraries'
)
const whiskyVersionPlist = join(whiskyWinePath, 'WhiskyWineVersion.plist')
const whiskyWineBin = join(whiskyWinePath, 'Wine/bin/wine64')

if (existsSync(whiskyVersionPlist) && existsSync(whiskyWineBin)) {
try {
const info = plistParse(
readFileSync(whiskyVersionPlist, 'utf-8')
) as PlistObject
const version = info['version']
const versionString = `${version['major']}.${version['minor']}.${version['patch']}-${version['build']}`
whisky.add({
bin: whiskyWineBin,
name: `Whisky - ${versionString}`,
type: 'toolkit',
lib: join(whiskyWinePath, 'Wine/lib'),
lib32: join(whiskyWinePath, 'Wine/lib'),
...getWineExecs(whiskyWineBin)
})
} catch (error) {
logError(
`Error getting wine version for ${whiskyWineBin}`,
LogPrefix.GlobalConfig
)
}
}

return whisky
}
Expand Down
Loading