Add check to make sure the patch gets applied

This commit is contained in:
Maroxy 2021-10-23 14:17:08 +02:00
parent ad4027da7c
commit 7bef675ec3

View file

@ -394,6 +394,16 @@ export class Genshinlib
patcherProcess.stdout.on('data', (data: string) => onData(data)); patcherProcess.stdout.on('data', (data: string) => onData(data));
patcherProcess.on('close', () => { patcherProcess.on('close', () => {
// Make sure that launcher.bat exists if not run patch.sh again.
if (!path.join(this.gameDir, 'launcher.bat'))
exec(`yes yes | ${path.join(patchDir, 'patch.sh')}`, {
cwd: this.gameDir,
env: {
...process.env,
WINEPREFIX: this.prefixDir
}
});
// Execute the patch file with "yes" in the beginning to agree to the choice. // Execute the patch file with "yes" in the beginning to agree to the choice.
let patcherAntiCrashProcess = exec(`yes | ${path.join(patchDir, 'patch_anti_logincrash.sh')}`, { let patcherAntiCrashProcess = exec(`yes | ${path.join(patchDir, 'patch_anti_logincrash.sh')}`, {
cwd: this.gameDir, cwd: this.gameDir,