Skip to content

Commit

Permalink
Restart automatically after update
Browse files Browse the repository at this point in the history
  • Loading branch information
chmaha committed Dec 11, 2024
1 parent 53da624 commit aa90b37
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions ReaClassical/ReaClassical_Updater.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
for key in pairs(reaper) do _G[key] = reaper[key] end

local main, copy_file, get_path, update_reaper_ini, update_keyb_ini
local ExecUpdate

---------------------------------------------------------------------

Expand Down Expand Up @@ -72,8 +73,7 @@ function main()
end

if response1 == 6 or response2 == 6 then
MB("4) REAPER/ReaClassical will now close.", "ReaClassical Updater", 0)
Main_OnCommand(40004, 0) -- Save dirty projects and close REAPER
ExecUpdate()
end
end

Expand Down Expand Up @@ -196,4 +196,30 @@ end

---------------------------------------------------------------------

function ExecUpdate()
local msg = [[
ReaClassical has to close for the update process to complete.
Should you have unsaved projects, you will be prompted to save them.
After the installation is complete, ReaClassical will restart automatically.
Quit ReaClassical?]]

local ret = MB(msg, "ReaClassical Updater", 4)
if ret == 7 then
return
end

Main_OnCommand(40886, 0)

if IsProjectDirty(0) == 0 then
Main_OnCommand(40063, 0)
Main_OnCommand(40004, 0)
else
MB("Restart cancelled!", "ReaClassical Updater", 0)
end
end

---------------------------------------------------------------------


main()

0 comments on commit aa90b37

Please sign in to comment.