Skip to content

Instantly share code, notes, and snippets.

@LPGhatguy
Created October 17, 2015 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LPGhatguy/4ab984d5d9a379aaffc0 to your computer and use it in GitHub Desktop.
Save LPGhatguy/4ab984d5d9a379aaffc0 to your computer and use it in GitHub Desktop.
Pote: The Portable Game FS Extension
local pote = require("pote")
function love.load(args)
pote.mount(args)
print(love.filesystem.read("app/main.lua"))
end
local ffi = require("ffi")
local liblove = (jit.os == "Windows" and ffi.load("love")) or ffi.C
local pote = {}
ffi.cdef([[
int PHYSFS_mount(const char* dir, const char* mountPoint, int append);
]])
function pote.mount(args)
local path = args[1]
if (love.filesystem.isFused()) then
path = path:match("^(.*)[\\/].-$")
end
liblove.PHYSFS_mount(path, "app", 1)
end
function pote.unmount(args)
love.filesystem.unmount("app")
end
return pote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment