1- import { existsSync } from 'graceful-fs'
1+ import { copyFileSync , existsSync } from 'graceful-fs'
22import axios from 'axios'
33
44import {
@@ -40,7 +40,8 @@ import {
4040 configStore ,
4141 isCLINoGui ,
4242 isLinux ,
43- epicRedistPath
43+ epicRedistPath ,
44+ fakeEpicExePath
4445} from '../../constants'
4546import {
4647 appendGamePlayLog ,
@@ -59,7 +60,8 @@ import {
5960 launchCleanup ,
6061 getRunnerCallWithoutCredentials ,
6162 runWineCommand as runWineCommandUtil ,
62- getKnownFixesEnvVariables
63+ getKnownFixesEnvVariables ,
64+ getWinePath
6365} from '../../launcher'
6466import {
6567 addShortcuts as addShortcutsUtil ,
@@ -876,6 +878,22 @@ export async function launch(
876878 ...getKnownFixesEnvVariables ( appName , 'legendary' )
877879 }
878880
881+ // We can get this env variable either from the game's settings or from known fixes
882+ if ( commandEnv [ 'USE_FAKE_EPIC_EXE' ] ) {
883+ const fakeExeWinPath = 'C:\\windows\\command\\EpicGamesLauncher.exe'
884+ const fakeEpicExePathInPrefix = await getWinePath ( {
885+ path : fakeExeWinPath ,
886+ gameSettings,
887+ variant : 'unix'
888+ } )
889+
890+ // we copy the file inside the prefix to avoid permission issues
891+ if ( ! existsSync ( fakeEpicExePathInPrefix ) )
892+ copyFileSync ( fakeEpicExePath , fakeEpicExePathInPrefix )
893+
894+ commandEnv [ 'LEGENDARY_WRAPPER_EXE' ] = fakeExeWinPath
895+ }
896+
879897 const wrappers = setupWrappers (
880898 gameSettings ,
881899 mangoHudCommand ,
0 commit comments