From 434dee59fc5b8d9191b0b48afaf9fdf392ae8ed3 Mon Sep 17 00:00:00 2001 From: Grump Date: Wed, 15 Jul 2020 07:55:04 +0200 Subject: [PATCH] replace love.path.leaf with local implementation, fixes #1 --- nativefs.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nativefs.lua b/nativefs.lua index 339159b..9b37ab9 100644 --- a/nativefs.lua +++ b/nativefs.lua @@ -348,9 +348,21 @@ local function getInfo(path, file, filtertype) return love.filesystem.getInfo(filepath, filtertype) 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) local dir = path:match("(.*[\\/]).*$") or './' - local file = love.path.leaf(path) + local file = leaf(path) local result, err = withTempMount(dir, getInfo, file, filtertype) return result or nil end