1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Better handling of temporary folders

This commit is contained in:
sfan5 2024-04-05 15:55:54 +02:00
parent f87994edc7
commit 7e4462e0ac
6 changed files with 34 additions and 17 deletions

View file

@ -98,15 +98,12 @@ local function download_and_extract(param)
local tempfolder = core.get_temp_path()
if tempfolder ~= "" then
tempfolder = tempfolder .. DIR_DELIM .. "MT_" .. math.random(1, 1024000)
if not core.extract_zip(filename, tempfolder) then
tempfolder = nil
end
else
tempfolder = nil
end
os.remove(filename)
if not tempfolder then
if not tempfolder or tempfolder == "" then
return {
msg = fgettext_ne("Failed to extract \"$1\" (unsupported file type or broken archive)", package.title),
}