replace love.path.leaf with local implementation, fixes #1

This commit is contained in:
Grump
2020-07-15 07:55:04 +02:00
parent fd61ce6e49
commit 434dee59fc

View File

@@ -348,9 +348,21 @@ local function getInfo(path, file, filtertype)
return love.filesystem.getInfo(filepath, filtertype) return love.filesystem.getInfo(filepath, filtertype)
end end
local function leaf(p)
p = p:gsub('\\', '/')
local last, a = p, 1
while a do
a = p:find('/', a + 1)
if a then
last = p:sub(a + 1)
end
end
return last
end
function nativefs.getInfo(path, filtertype) function nativefs.getInfo(path, filtertype)
local dir = path:match("(.*[\\/]).*$") or './' local dir = path:match("(.*[\\/]).*$") or './'
local file = love.path.leaf(path) local file = leaf(path)
local result, err = withTempMount(dir, getInfo, file, filtertype) local result, err = withTempMount(dir, getInfo, file, filtertype)
return result or nil return result or nil
end end