From ea33b521a4ab6e049526d8a4cfb995a37b8c6fa1 Mon Sep 17 00:00:00 2001 From: Grump Date: Thu, 7 May 2020 20:16:34 +0200 Subject: [PATCH] add check if already mounted in getDirectoryItems --- nativefs.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nativefs.lua b/nativefs.lua index 7d2e080..2eab17f 100644 --- a/nativefs.lua +++ b/nativefs.lua @@ -4,6 +4,7 @@ local nativefs = {} ffi.cdef([[ int PHYSFS_mount(const char* dir, const char* mountPoint, int appendToPath); int PHYSFS_unmount(const char* dir); + const char* PHYSFS_getMountPoint(const char* dir); typedef struct FILE FILE; @@ -355,6 +356,11 @@ function nativefs.load(name) end function nativefs.getDirectoryItems(dir, callback) + local mountPoint = loveC.PHYSFS_getMountPoint(dir) + if mountPoint ~= nil then + return love.filesystem.getDirectoryItems(ffi.string(mountPoint), callback) + end + if not nativefs.mount(dir, '__nativefs__temp__') then return false, "Could not mount " .. dir end