Merge driver.love

This commit is contained in:
Kartik K. Agaram 2023-12-18 13:04:27 -08:00
commit 74885b2708
3 changed files with 8 additions and 4 deletions

View File

@ -1,7 +1,7 @@
load_metadata = function(filename)
local mfile = metadata_file(filename)
local mpath = full_path(mfile)
if not nativefs.getInfo(mpath) then
if not App.file_info(mpath) then
-- comments will always have metadata,
-- so we only get here for top-level posts with no parent
return {replies={}}

View File

@ -121,6 +121,7 @@ function love.run()
return --[[status]] true
end
App.files = nativefs.getDirectoryItems
App.file_info = nativefs.getInfo
App.mkdir = nativefs.createDirectory
App.remove = nativefs.remove
App.source_dir = love.filesystem.getSource()..'/' -- '/' should work even on Windows

View File

@ -383,13 +383,16 @@ The following facilities help set these things up:
available under `dir`.
(From [LÖVE](https://love2d.org/wiki/love.filesystem.getDirectoryItems).]
* `love.filesystem.getInfo(filename)` -- returns some information about
* `App.file_info(filename)` -- returns some information about
`filename`, particularly whether it exists (non-`nil` return value) or not.
(From [LÖVE](https://love2d.org/wiki/love.filesystem.getInfo).]
* `os.remove(filename)` -- removes a file or empty directory. Definitely make
* `App.mkdir(path)` -- creates a directory. Make sure `path` is absolute.
(From [LÖVE](https://love2d.org/wiki/love.filesystem.remove).]
* `App.remove(filename)` -- removes a file or empty directory. Definitely make
sure `filename` is an absolute path.
(From [Lua](https://www.lua.org/manual/5.1/manual.html#pdf-os.remove).)
(From [LÖVE](https://love2d.org/wiki/love.filesystem.remove).]
There's much more I could include here; check out [the LÖVE manual](https://love2d.org/wiki/love.filesystem)
and [the Lua manual](https://www.lua.org/manual/5.1/manual.html#5.7).