new primitives for reading/writing files
[?]
Sep 9, 2023, 3:56 PM
FQURPLDAJ23WHRCFKBL3UFDL2MAQIJ7NIOXS7H6MLOGLW2QB33UACDependencies
- [2]
C4YSIYPOreorder - [*]
3QNOKBFMbeginnings of a test harness - [*]
CUFW4EJLreorganize app.lua and its comments - [*]
HOWVSTWAa few more testable file-system operations - [*]
ED4Z6ORCcleaner API for file-system access - [*]
HKV72RZVbugfix: save modified files in save directory
Change contents
- edit in app.lua at line 291
function App.read_file(filename)return App.filesystem[filename]end - edit in app.lua at line 306
function App.write_file(filename, contents)App.filesystem[filename] = contentsreturn --[[status]] trueend - edit in app.lua at line 445[7.16250][8.624]
endendApp.read =function(path)if not is_absolute_path(path) thenreturn --[[status]] false, 'Please use an unambiguous absolute path.'endlocal f, err = App.open_for_reading(path)if err thenreturn --[[status]] false, err - edit in app.lua at line 456[8.636][7.16251]
local contents = f:read()f:close()return contents - edit in app.lua at line 470
App.write =function(filename, contents)if not is_absolute_path(path) thenreturn --[[status]] false, 'Please use an unambiguous absolute path.'endlocal f, err = App.open_for_writing(filename)if err thenreturn --[[status]] false, errendf:write(contents)f:close()end