Skip to content

Commit

Permalink
Fix incorrect extension used for ContentDB thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Jun 6, 2020
1 parent 60bab8b commit 36099ba
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion builtin/mainmenu/dlg_contentstore.lua
Expand Up @@ -133,6 +133,11 @@ local function start_install(calling_dialog, package)
end
end

local function get_file_extension(path)
local parts = path:split(".")
return parts[#parts]
end

local function get_screenshot(package)
if not package.thumbnail then
return defaulttexturedir .. "no_screenshot.png"
Expand All @@ -141,8 +146,9 @@ local function get_screenshot(package)
end

-- Get tmp screenshot path
local ext = get_file_extension(package.thumbnail)
local filepath = screenshot_dir .. DIR_DELIM ..
package.type .. "-" .. package.author .. "-" .. package.name .. ".png"
("%s-%s-%s.%s"):format(package.type, package.author, package.name, ext)

-- Return if already downloaded
local file = io.open(filepath, "r")
Expand Down

0 comments on commit 36099ba

Please sign in to comment.