From 583b8c29e3490308de7e70565837bbe2bf57bc5f Mon Sep 17 00:00:00 2001 From: swordcube <49110074+swordcube@users.noreply.github.com> Date: Fri, 23 Dec 2022 11:35:25 -0600 Subject: [PATCH] Allow game to reopen after updating executable Allows the game to reopen after updating the executable through `UpdateScreen` on Linux. --- source/funkin/updating/UpdateScreen.hx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/funkin/updating/UpdateScreen.hx b/source/funkin/updating/UpdateScreen.hx index 97355850..f3a1b451 100644 --- a/source/funkin/updating/UpdateScreen.hx +++ b/source/funkin/updating/UpdateScreen.hx @@ -123,7 +123,13 @@ class UpdateScreen extends MusicBeatState { FlxG.camera.fade(0xFF000000, overSound.length / 1000, false, function() { if (updater.executableReplaced) { // the executable has been replaced, restart the game entirely + #if windows Sys.command('start /B ${AsyncUpdater.executableName}'); + #else + // We have to make the new executable allowed to execute + // before we can execute it! + Sys.command('chmod +x ./${AsyncUpdater.executableName} && ./${AsyncUpdater.executableName}'); + #end openfl.system.System.exit(0); } else { // assets update, switch back to TitleState. @@ -133,4 +139,4 @@ class UpdateScreen extends MusicBeatState { bf.clipRect = null; } } -} \ No newline at end of file +}