mirror of
https://github.com/Oreolek/ink-instead.git
synced 2024-07-16 21:44:38 +03:00
.love file packaging support
This commit is contained in:
parent
0ef5f2227c
commit
b9a7c2e73c
|
@ -3,12 +3,17 @@ local parser = require(folderOfThisFile .. 'parser')
|
||||||
local runtime = require(folderOfThisFile .. 'runtime')
|
local runtime = require(folderOfThisFile .. 'runtime')
|
||||||
|
|
||||||
|
|
||||||
local function read(file)
|
local function read(file) -- TODO should this be here or in client code? At lease allow to pass an ink content in a string
|
||||||
|
if love and love.filesystem and love.filesystem.read then
|
||||||
|
local content, size = love.filesystem.read(file)
|
||||||
|
return content
|
||||||
|
else
|
||||||
local f = io.open(file, "rb")
|
local f = io.open(file, "rb")
|
||||||
if not f then error('failed to open "'..file..'"') end
|
if not f then error('failed to open "'..file..'"') end
|
||||||
local content = f:read("*all")
|
local content = f:read("*all")
|
||||||
f:close()
|
f:close()
|
||||||
return content
|
return content
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue