Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion utils/buildactions/install_cef.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ newaction {
else
-- Download CEF
print("Downloading CEF " .. CEF_VERSION .. "...")
if not http.download_print_errors(make_cef_download_url(), archive_path) then
if not http.download_print_errors(make_cef_download_url(), archive_path, { progress = http.create_download_progress_handler{update_interval_s = 5} }) then
os.exit(1)
return
end
Expand Down
18 changes: 18 additions & 0 deletions utils/buildactions/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,24 @@ function os.extract_archive(archive_path, target_path, override)
return false
end

function http.create_download_progress_handler(options)
local last_update = 0

return function (total, current)
local tick = os.clock()
if tick - last_update < options.update_interval_s then
return
end

last_update = tick

local ratio = current / total;
ratio = math.min(math.max(ratio, 0), 1)
local percent = math.floor(ratio * 100)
print(string.format("Downloading (%d/%d) %d%%", current, total, percent))
end
end

function http.download_print_errors(url, file, options)
local result_str, response_code = http.download(url, file, options)
if result_str ~= "OK" then
Expand Down
Loading