start saving edits right in the source dir
[?]
Sep 9, 2023, 5:47 PM
2NQZJUPTOHIMDTSB2V53KQ5HLKKUUHQEKVB4XEHVFXOSI7UUGCJACDependencies
- [2]
FD6GKGZEadd a link - [3]
55UFMP6Uslightly easier to understand - [4]
TFRXO4PWsimplify check for '0000' - [5]
GACNGS44combine 2 levels of indent - [6]
3LU2TYSWbugfix: deleting definitions - [7]
LRDM35CEapp running again - [8]
FFFJ54GJrestore globals after running tests - [9]
NMZSTB75one more fix - [10]
EZHO4TSWnew file-system format for freewheeling apps - [11]
2DVVKKVAflesh out Readme - [12]
3BRGOF7Nreturn failing tests with every code change - [13]
WYKKFV2Gprevent overriding foundational definitions - [14]
IJQP7HJKbugfix: only include files with numeric _prefixes_ - [15]
D4FEFHQCflesh out Readme - [*]
BSDXVB3Hbackport some doc updates and renames - [*]
FS2ITYYHrecord a known issue
Change contents
- edit in live.lua at line 19
-- We try to save new definitions in the source directory, but this is not-- possible if the app lives in a .love file. In that case new definitions-- go in the save dir. - edit in live.lua at line 51[5.2087]→[5.2087:2158](∅→∅),[5.2158]→[5.586:857](∅→∅),[5.857]→[5.9:103](∅→∅),[5.103]→[5.950:1081](∅→∅),[5.950]→[5.950:1081](∅→∅),[5.1081]→[5.3845:3869](∅→∅),[5.3845]→[5.3845:3869](∅→∅),[5.3869]→[3.10:111](∅→∅)
print('new edits will go to ' .. love.filesystem.getSaveDirectory())-- if necessary, copy files from repo to save dirif io.open(love.filesystem.getSaveDirectory()..'/0000-freewheeling-start') == nil thenprint('copying all definitions from repo to save dir')for _,filename in ipairs(love.filesystem.getDirectoryItems('')) dolocal numeric_prefix, root = filename:match('^(%d+)-(.+)')if numeric_prefix thenlocal buf = love.filesystem.read(filename)print('copying', filename)love.filesystem.write(filename, buf)endendend-- list files to load in save dir-- (ignore the repo because we might have deleted definitions) - replacement in live.lua at line 52[5.1181]→[5.9:145](∅→∅),[5.145]→[4.11:77](∅→∅),[4.77]→[5.85:261](∅→∅),[5.85]→[5.85:261](∅→∅),[5.261]→[5.4253:4263](∅→∅),[5.427]→[5.4253:4263](∅→∅),[5.1480]→[5.4253:4263](∅→∅),[5.4253]→[5.4253:4263](∅→∅)
if io.open(love.filesystem.getSaveDirectory()..'/'..filename) thenlocal numeric_prefix, root = filename:match('^(%d+)-(.+)')if numeric_prefix and not numeric_prefix:match('^0+$') thenLive.filename[root] = filenametable.insert(Live.filenames_to_load, filename)Live.final_prefix = math.max(Live.final_prefix, tonumber(numeric_prefix))endlocal numeric_prefix, root = filename:match('^(%d+)-(.+)')if numeric_prefix and tonumber(numeric_prefix) > 0 then -- skip 0000Live.filename[root] = filenametable.insert(Live.filenames_to_load, filename)Live.final_prefix = math.max(Live.final_prefix, tonumber(numeric_prefix)) - edit in live.lua at line 156
-- try to remove the file from both source_dir and save_dir-- this won't work for files inside .love filesApp.remove(App.source_dir..Live.filename[definition_name]) - replacement in live.lua at line 214
love.filesystem.write(filename, buf)-- try to write to source dirlocal status, err = App.write_file(App.source_dir..filename, buf)if err then-- not possible; perhaps it's a .love file-- try to write to save dirlocal status, err2 = App.write_file(App.save_dir..filename, buf)if err2 then-- throw an errorlive.send_to_driver('ERROR '..tostring(err..'\n\n'..err2))returnendend - replacement in README.md at line 30
To publish your changes:* delete all files with a numeric prefix from the repo, and then* move all files with a numeric prefix from the [save directory](https://love2d.org/wiki/love.filesystem.getSaveDirectory)to the repo.If you run a .love file, your changes will go into the [save directory](https://love2d.org/wiki/love.filesystem.getSaveDirectory).If you unzip the .love file into a new directory and run the directoryinstead, your changes will go straight into the same directory.