@@ -69,7 +69,7 @@ import { showDialogBoxModalAuto } from './dialog/dialog'
69
69
import { legendarySetup } from './storeManagers/legendary/setup'
70
70
import { gameManagerMap } from 'backend/storeManagers'
71
71
import * as VDF from '@node-steam/vdf'
72
- import { readFileSync } from 'fs'
72
+ import { readFileSync , writeFileSync } from 'fs'
73
73
import { LegendaryCommand } from './storeManagers/legendary/commands'
74
74
import { commandToArgsArray } from './storeManagers/legendary/library'
75
75
import { searchForExecutableOnPath } from './utils/os/path'
@@ -347,10 +347,27 @@ async function prepareWineLaunch(
347
347
}
348
348
}
349
349
350
- const { updated : winePrefixUpdated } = await verifyWinePrefix ( gameSettings )
350
+ await verifyWinePrefix ( gameSettings )
351
351
const experimentalFeatures =
352
352
GlobalConfig . get ( ) . getSettings ( ) . experimentalFeatures
353
- if ( winePrefixUpdated ) {
353
+
354
+ let hasUpdated = false
355
+ const appsNamesPath = join ( gameSettings . winePrefix , 'installed_games' )
356
+ if ( ! existsSync ( appsNamesPath ) ) {
357
+ writeFileSync ( appsNamesPath , JSON . stringify ( [ appName ] ) , 'utf-8' )
358
+ hasUpdated = true
359
+ } else {
360
+ const installedGames : string [ ] = JSON . parse (
361
+ readFileSync ( appsNamesPath , 'utf-8' )
362
+ )
363
+ if ( ! installedGames . includes ( appName ) ) {
364
+ installedGames . push ( appName )
365
+ writeFileSync ( appsNamesPath , JSON . stringify ( installedGames ) , 'utf-8' )
366
+ hasUpdated = true
367
+ }
368
+ }
369
+
370
+ if ( hasUpdated ) {
354
371
logInfo (
355
372
[ 'Created/Updated Wineprefix at' , gameSettings . winePrefix ] ,
356
373
LogPrefix . Backend
@@ -789,17 +806,17 @@ export async function validWine(
789
806
*/
790
807
export async function verifyWinePrefix (
791
808
settings : GameSettings
792
- ) : Promise < { res : ExecResult ; updated : boolean } > {
809
+ ) : Promise < { res : ExecResult } > {
793
810
const { winePrefix = defaultWinePrefix , wineVersion } = settings
794
811
795
812
const isValidWine = await validWine ( wineVersion )
796
813
797
814
if ( ! isValidWine ) {
798
- return { res : { stdout : '' , stderr : '' } , updated : false }
815
+ return { res : { stdout : '' , stderr : '' } }
799
816
}
800
817
801
818
if ( wineVersion . type === 'crossover' ) {
802
- return { res : { stdout : '' , stderr : '' } , updated : false }
819
+ return { res : { stdout : '' , stderr : '' } }
803
820
}
804
821
805
822
if ( ! existsSync ( winePrefix ) && ! ( await isUmuSupported ( wineVersion . type ) ) ) {
@@ -825,13 +842,7 @@ export async function verifyWinePrefix(
825
842
826
843
return command
827
844
. then ( ( result ) => {
828
- // This is kinda hacky
829
- const wasUpdated = result . stderr . includes (
830
- wineVersion . type === 'proton'
831
- ? 'Proton: Upgrading prefix from'
832
- : 'has been updated'
833
- )
834
- return { res : result , updated : wasUpdated }
845
+ return { res : result }
835
846
} )
836
847
. catch ( ( error ) => {
837
848
logError ( [ 'Unable to create Wineprefix: ' , error ] , LogPrefix . Backend )
0 commit comments