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"