mirror of
https://github.com/EngineerSmith/nativefs.git
synced 2025-11-08 23:15:02 +00:00
replace love.path.leaf with local implementation, fixes #1
This commit is contained in:
14
nativefs.lua
14
nativefs.lua
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user