From 08323e00ff7bf7b4ce0607dc2dd0a8ecb5ae95c4 Mon Sep 17 00:00:00 2001 From: Astronand Date: Thu, 12 Mar 2026 11:56:58 -0400 Subject: [PATCH] Update install/data/tarbad --- install/data/tarbad | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/install/data/tarbad b/install/data/tarbad index caa6983..5232bb5 100644 --- a/install/data/tarbad +++ b/install/data/tarbad @@ -98,29 +98,30 @@ local function unpack_tar(tarstr) local pad = (512 - (size % 512)) % 512 i = i + size + pad - if name == "" then goto continue end + if name ~= "" then - local is_dir = typeflag == "5" or name:sub(-1) == "/" + local is_dir = typeflag == "5" or name:sub(-1) == "/ + local clean_name = name:gsub("/$", "") + + if clean_name ~= "" then - local clean_name = name:gsub("/$", "") - if clean_name == "" then goto continue end + local parent_path = clean_name:match("(.+)/") + local fname = clean_name:match("([^/]+)$") + if not fname then - local parent_path = clean_name:match("(.+)/") - local fname = clean_name:match("([^/]+)$") - if not fname then goto continue end - - local parent = root - if parent_path then - parent = make_dirs(root, parent_path .. "/") + local parent = root + if parent_path then + parent = make_dirs(root, parent_path .. "/") + end + + if is_dir then + parent[fname] = parent[fname] or { __type = "dir", __entries = {} } + else + parent[fname] = { __type = "file", __contents = contents } + end + end + end end - - if is_dir then - parent[fname] = parent[fname] or { __type = "dir", __entries = {} } - else - parent[fname] = { __type = "file", __contents = contents } - end - - ::continue:: end return flatten(root)