Skip to content

Commit

Permalink
Cache installed wine version on prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Snaggly committed Sep 24, 2024
1 parent aefe212 commit 2423427
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
19 changes: 11 additions & 8 deletions src/backend/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ import { showDialogBoxModalAuto } from './dialog/dialog'
import { legendarySetup } from './storeManagers/legendary/setup'
import { gameManagerMap } from 'backend/storeManagers'
import * as VDF from '@node-steam/vdf'
import { readFileSync } from 'fs'
import { readFileSync, writeFileSync } from 'fs'
import { LegendaryCommand } from './storeManagers/legendary/commands'
import { commandToArgsArray } from './storeManagers/legendary/library'
import { searchForExecutableOnPath } from './utils/os/path'
Expand Down Expand Up @@ -826,13 +826,16 @@ export async function verifyWinePrefix(

return command
.then((result) => {
// This is kinda hacky
const wasUpdated = result.stderr.includes(
wineVersion.type === 'proton'
? 'Proton: Upgrading prefix from'
: 'has been updated'
)
return { res: result, updated: wasUpdated }
const currentWinePath = join(winePrefix, 'current_wine')
if (
!existsSync(currentWinePath) ||
readFileSync(currentWinePath, 'utf-8') != wineVersion.bin
) {
writeFileSync(currentWinePath, wineVersion.bin, 'utf-8')
return { res: result, updated: true }
} else {
return { res: result, updated: false }
}
})
.catch((error) => {
logError(['Unable to create Wineprefix: ', error], LogPrefix.Backend)
Expand Down
8 changes: 4 additions & 4 deletions src/backend/utils/systeminfo/osInfo/linux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ async function osInfo_linux(): Promise<{ name: string; version?: string }> {
const osName = nameMatch
? stripQuotes(nameMatch)
: prettyNameMatch
? stripQuotes(prettyNameMatch)
: 'Linux'
? stripQuotes(prettyNameMatch)
: 'Linux'
const osVersion = versionMatch
? stripQuotes(versionMatch)
: versionId && versionCodename
? `${versionId} ${versionCodename}`
: undefined
? `${versionId} ${versionCodename}`
: undefined
if (osVersion) return { name: osName, version: osVersion }
return { name: osName }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function ProgressHeader(props: {
download:
progress.downSpeed && progress.downSpeed > 0
? progress.downSpeed
: avgSpeed.at(-1)?.download ?? 0,
: (avgSpeed.at(-1)?.download ?? 0),
disk: progress.diskSpeed ?? 0
})

Expand Down Expand Up @@ -126,7 +126,7 @@ export default function ProgressHeader(props: {
title={t('download-manager.ETA', 'Estimated Time')}
>
{props.state === 'running'
? progress.eta ?? '00.00.00'
? (progress.eta ?? '00.00.00')
: 'Paused'}
</Typography>
</Box>
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/screens/Game/GamePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ export default React.memo(function GamePage(): JSX.Element | null {
(is_linux_native && isLinux
? 'linux'
: is_mac_native && isMac
? 'Mac'
: 'Windows')
? 'Mac'
: 'Windows')

if (
runner !== 'sideload' &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ export default React.memo(function InstallModal({
return 'Windows'
}

const [platformToInstall, setPlatformToInstall] = useState<InstallPlatform>(
getDefaultplatform()
)
const [platformToInstall, setPlatformToInstall] =
useState<InstallPlatform>(getDefaultplatform())

const hasWine = platformToInstall === 'Windows' && !isWin

Expand Down

0 comments on commit 2423427

Please sign in to comment.