Created
October 17, 2015 09:27
-
-
Save LPGhatguy/4ab984d5d9a379aaffc0 to your computer and use it in GitHub Desktop.
Pote: The Portable Game FS Extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local pote = require("pote") | |
function love.load(args) | |
pote.mount(args) | |
print(love.filesystem.read("app/main.lua")) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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