Skip to content

Commit 2423427

Browse files
committed
Cache installed wine version on prefix
1 parent aefe212 commit 2423427

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

src/backend/launcher.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ import { showDialogBoxModalAuto } from './dialog/dialog'
6969
import { legendarySetup } from './storeManagers/legendary/setup'
7070
import { gameManagerMap } from 'backend/storeManagers'
7171
import * as VDF from '@node-steam/vdf'
72-
import { readFileSync } from 'fs'
72+
import { readFileSync, writeFileSync } from 'fs'
7373
import { LegendaryCommand } from './storeManagers/legendary/commands'
7474
import { commandToArgsArray } from './storeManagers/legendary/library'
7575
import { searchForExecutableOnPath } from './utils/os/path'
@@ -826,13 +826,16 @@ export async function verifyWinePrefix(
826826

827827
return command
828828
.then((result) => {
829-
// This is kinda hacky
830-
const wasUpdated = result.stderr.includes(
831-
wineVersion.type === 'proton'
832-
? 'Proton: Upgrading prefix from'
833-
: 'has been updated'
834-
)
835-
return { res: result, updated: wasUpdated }
829+
const currentWinePath = join(winePrefix, 'current_wine')
830+
if (
831+
!existsSync(currentWinePath) ||
832+
readFileSync(currentWinePath, 'utf-8') != wineVersion.bin
833+
) {
834+
writeFileSync(currentWinePath, wineVersion.bin, 'utf-8')
835+
return { res: result, updated: true }
836+
} else {
837+
return { res: result, updated: false }
838+
}
836839
})
837840
.catch((error) => {
838841
logError(['Unable to create Wineprefix: ', error], LogPrefix.Backend)

src/backend/utils/systeminfo/osInfo/linux.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ async function osInfo_linux(): Promise<{ name: string; version?: string }> {
4141
const osName = nameMatch
4242
? stripQuotes(nameMatch)
4343
: prettyNameMatch
44-
? stripQuotes(prettyNameMatch)
45-
: 'Linux'
44+
? stripQuotes(prettyNameMatch)
45+
: 'Linux'
4646
const osVersion = versionMatch
4747
? stripQuotes(versionMatch)
4848
: versionId && versionCodename
49-
? `${versionId} ${versionCodename}`
50-
: undefined
49+
? `${versionId} ${versionCodename}`
50+
: undefined
5151
if (osVersion) return { name: osName, version: osVersion }
5252
return { name: osName }
5353
}

src/frontend/screens/DownloadManager/components/ProgressHeader/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function ProgressHeader(props: {
4343
download:
4444
progress.downSpeed && progress.downSpeed > 0
4545
? progress.downSpeed
46-
: avgSpeed.at(-1)?.download ?? 0,
46+
: (avgSpeed.at(-1)?.download ?? 0),
4747
disk: progress.diskSpeed ?? 0
4848
})
4949

@@ -126,7 +126,7 @@ export default function ProgressHeader(props: {
126126
title={t('download-manager.ETA', 'Estimated Time')}
127127
>
128128
{props.state === 'running'
129-
? progress.eta ?? '00.00.00'
129+
? (progress.eta ?? '00.00.00')
130130
: 'Paused'}
131131
</Typography>
132132
</Box>

src/frontend/screens/Game/GamePage/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ export default React.memo(function GamePage(): JSX.Element | null {
193193
(is_linux_native && isLinux
194194
? 'linux'
195195
: is_mac_native && isMac
196-
? 'Mac'
197-
: 'Windows')
196+
? 'Mac'
197+
: 'Windows')
198198

199199
if (
200200
runner !== 'sideload' &&

src/frontend/screens/Library/components/InstallModal/index.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,8 @@ export default React.memo(function InstallModal({
100100
return 'Windows'
101101
}
102102

103-
const [platformToInstall, setPlatformToInstall] = useState<InstallPlatform>(
104-
getDefaultplatform()
105-
)
103+
const [platformToInstall, setPlatformToInstall] =
104+
useState<InstallPlatform>(getDefaultplatform())
106105

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

0 commit comments

Comments
 (0)