return function(ll) ll.mdir = nil ll.mgme = nil if love.getVersion() >= 12 then function ll._mntdir(dir) return love.filesystem.mountFullPath(dir, '/') end function ll._umntdir(dir) love.filesystem.unmountFullPath(dir) end else local ffi = require 'ffi' ffi.cdef [[ int PHYSFS_mount(const char *, const char *, int); int PHYSFS_unmount(const char *);]] -- FIXME: Bug may appear in Linux. Recompile Love2D or use official PPA. function ll._mntdir(dir) return ffi.C.PHYSFS_mount(dir, '/', 0) ~= 0 end function ll._umntdir(dir) ffi.C.PHYSFS_unmount(dir) end end local baseReq = '?.lua;?/init.lua;' function ll.mount(gme) local mdir = gme.base .. gme.dir love.filesystem.setRequirePath( mdir .. '/?.lua;' .. mdir .. '/?/init.lua;' .. baseReq ) if ll._mntdir(mdir) then ll.mdir, ll.mgme = mdir, gme else error('Cannot mount '..mdir) love.filesystem.setRequirePath(baseReq) end end function ll.umount() if ll.mdir ~= nil then ll._umntdir(ll.mdir) ll.mdir = nil end end end