Skip to content

Commit cb5af3e

Browse files
committed
Prompt for updating install_cef.lua
1 parent f3b9f7e commit cb5af3e

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

utils/buildactions/install_cef.lua

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,23 @@ function errormsg(title, message)
2727
term.popColor()
2828
end
2929

30+
function update_install_cef(version, hash)
31+
local filename = "utils/buildactions/install_cef.lua"
32+
local f = io.open(filename)
33+
local text = f:read("*all")
34+
f:close()
35+
36+
-- Replace version and hash lines
37+
local version_line = 'local CEF_VERSION = "' .. version .. '"'
38+
local hash_line = 'local CEF_HASH = "' .. hash .. '"'
39+
text = text:gsub('local CEF_VERSION = ".-"', version_line, 1)
40+
text = text:gsub('local CEF_HASH = ".-"', hash_line, 1)
41+
42+
local f = io.open(filename, "w")
43+
f:write(text)
44+
f:close()
45+
end
46+
3047
newaction {
3148
trigger = "install_cef",
3249
description = "Downloads and installs CEF",
@@ -91,7 +108,13 @@ newaction {
91108
if upgrade then
92109
local downloaded_hash = os.sha256_file(archive_path)
93110
print("New CEF hash is:", downloaded_hash)
94-
return
111+
CEF_HASH = downloaded_hash
112+
113+
io.write(("Update `install_cef.lua` file? (Y/n) "):format(version))
114+
local input = io.read():lower()
115+
if (input == "y" or input == "yes") then
116+
update_install_cef(CEF_VERSION, downloaded_hash)
117+
end
95118
end
96119

97120
-- Seriously abort now if we're not using Windows

0 commit comments

Comments
 (0)