log.lua: Shouldn't assert on failed fs.open because this way it doesn't run on read only filesystem and really doesn't matter if it fails

This commit is contained in:
2026-06-06 21:49:05 +03:00
parent 08af85f3b4
commit ac1e58abcf
+3 -6
View File
@@ -55,14 +55,11 @@ local logFileSizeLimit = 16384
local function writeToLog(path, text)
fs.makeDirectory("halyde/logs") -- Git likes to not clone empty directories
local handle
if fs.exists(path) then
handle = assert(fs.open(path, "a"))
else
handle = assert(fs.open(path, "w"))
end
local handle = fs.open(path, "a")
if handle then
handle:write(text .. "\n")
handle:close()
end
-- Log trimming if it gets too long
if fs.size(path) > logFileSizeLimit then