mirror of
https://github.com/EngineerSmith/nativefs.git
synced 2025-11-08 23:15:02 +00:00
add check if already mounted in getDirectoryItems
This commit is contained in:
@@ -4,6 +4,7 @@ local nativefs = {}
|
|||||||
ffi.cdef([[
|
ffi.cdef([[
|
||||||
int PHYSFS_mount(const char* dir, const char* mountPoint, int appendToPath);
|
int PHYSFS_mount(const char* dir, const char* mountPoint, int appendToPath);
|
||||||
int PHYSFS_unmount(const char* dir);
|
int PHYSFS_unmount(const char* dir);
|
||||||
|
const char* PHYSFS_getMountPoint(const char* dir);
|
||||||
|
|
||||||
typedef struct FILE FILE;
|
typedef struct FILE FILE;
|
||||||
|
|
||||||
@@ -355,6 +356,11 @@ function nativefs.load(name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function nativefs.getDirectoryItems(dir, callback)
|
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
|
if not nativefs.mount(dir, '__nativefs__temp__') then
|
||||||
return false, "Could not mount " .. dir
|
return false, "Could not mount " .. dir
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user