From dd38d2e6ff3ffb36a3ffc67e2a7d3e9256fc6a5b Mon Sep 17 00:00:00 2001 From: fed <58637860+fedddddd@users.noreply.github.com> Date: Mon, 31 Jan 2022 09:03:59 +0100 Subject: [PATCH] Dont update if debug build --- src/client/game/ui_scripting/lua/context.cpp | 5 +++ src/client/resources/updater.lua | 33 +++++++++++++++----- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/client/game/ui_scripting/lua/context.cpp b/src/client/game/ui_scripting/lua/context.cpp index c884b4c1..6467eec5 100644 --- a/src/client/game/ui_scripting/lua/context.cpp +++ b/src/client/game/ui_scripting/lua/context.cpp @@ -1185,6 +1185,11 @@ namespace ui_scripting::lua utils::nt::terminate(); }; + game_type["isdebugbuild"] = [](const game&) + { + return DEBUG; + }; + struct player { }; diff --git a/src/client/resources/updater.lua b/src/client/resources/updater.lua index be1da95e..b241ff38 100644 --- a/src/client/resources/updater.lua +++ b/src/client/resources/updater.lua @@ -173,29 +173,46 @@ function updaterpopup(oncancel) }) end +function deleteoldfile() + io.removefile(game:binaryname() .. ".old") +end + +deleteoldfile() + function verifyfiles(files) local needed = {} - local needtoupdatebinary = false + local updatebinary = false + + if (game:isdebugbuild()) then + --return needed, updaetbinary + end + local binaryname = game:binaryname() for i = 1, #files do local name = files[i][1] - if (not io.fileexists(name) or game:sha(io.readfile(name)) ~= files[i][3]) then - if (name == game:binaryname()) then - needtoupdatebinary = true - end - - table.insert(needed, files[i]) + if (io.fileexists(name) and game:sha(io.readfile(name)) == files[i][3]) then + goto continue end + + if (name == binaryname) then + updatebinary = true + end + + table.insert(needed, files[i]) + + ::continue:: end - return needed, needtoupdatebinary + return needed, updatebinary end local canceled = false function downloadfiles(popup, files, callback) + deleteoldfile() + local text = popup:getchildren()[7] local folder = game:environment() == "develop" and "data-dev" or "data"