Merge template-live-editor-mobile

This commit is contained in:
Kartik K. Agaram 2023-12-18 11:44:55 -08:00
commit b8128fb0b3
2 changed files with 4 additions and 4 deletions

View File

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

View File

@ -163,7 +163,7 @@ function live.run(buf)
live.eval(definition_name..' = nil', 'driver') -- ignore errors which will likely be from keywords like `function = nil`
-- try to remove the file from both source_dir and save_dir
-- this won't work for files inside .love files
App.remove(App.source_dir..Live.filename[definition_name])
nativefs.remove(App.source_dir..Live.filename[definition_name])
love.filesystem.remove(Live.filename[definition_name])
Live.filename[definition_name] = nil
end
@ -221,10 +221,9 @@ function live.run(buf)
Live.filename[definition_name] = filename
end
-- try to write to source dir
local status, err = App.write_file(App.source_dir..filename, buf)
local status, err = nativefs.write(App.source_dir..filename, buf)
if err then
-- not possible; perhaps it's a .love file
-- try to write to save dir
-- fall back on save dir
local status, err2 = love.filesystem.write(filename, buf)
if err2 then
-- throw an error