|
|
@ -74,7 +74,13 @@ function make_regex(filename, version) |
|
|
|
-- Returns two regexes, meant to be used in a loop. (See code using this function to know what I mean) |
|
|
|
--]]-- |
|
|
|
|
|
|
|
local regex = escape_regex(filename:gsub(escape_regex(version), "{{version}}"):gsub("%%", "%%%%")) |
|
|
|
local temp_filename = filename:gsub(escape_regex(version), "{{version}}") |
|
|
|
if temp_filename == filename then |
|
|
|
-- If we can't find version in filename, return. |
|
|
|
return nil, nil |
|
|
|
end |
|
|
|
|
|
|
|
local regex = escape_regex(temp_filename:gsub("%%", "%%%%")) |
|
|
|
return regex:gsub("{{version}}", "(.-") .. ")", regex:gsub(".*{{version}}", "(.-)") |
|
|
|
end |
|
|
|
|
|
|
@ -118,6 +124,7 @@ function get_available_versions(satellite) |
|
|
|
for update_name in update_names:gmatch("[^,]+") do |
|
|
|
local loop_regex, end_regex = make_regex(update_name, version) |
|
|
|
|
|
|
|
if loop_regex and end_regex then |
|
|
|
for x in update_file:gmatch(loop_regex) do |
|
|
|
-- Sometimes, the match starts way too soon, and we get a very long "version" number. |
|
|
|
-- Here we make sure we really get the shortest possible match. |
|
|
@ -132,6 +139,7 @@ function get_available_versions(satellite) |
|
|
|
count = count + 1 |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
io.stderr:write("\x1B[1K\r") |
|
|
|
|
|
|
|