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:
+3
-6
@@ -55,14 +55,11 @@ local logFileSizeLimit = 16384
|
|||||||
|
|
||||||
local function writeToLog(path, text)
|
local function writeToLog(path, text)
|
||||||
fs.makeDirectory("halyde/logs") -- Git likes to not clone empty directories
|
fs.makeDirectory("halyde/logs") -- Git likes to not clone empty directories
|
||||||
local handle
|
local handle = fs.open(path, "a")
|
||||||
if fs.exists(path) then
|
if handle then
|
||||||
handle = assert(fs.open(path, "a"))
|
|
||||||
else
|
|
||||||
handle = assert(fs.open(path, "w"))
|
|
||||||
end
|
|
||||||
handle:write(text .. "\n")
|
handle:write(text .. "\n")
|
||||||
handle:close()
|
handle:close()
|
||||||
|
end
|
||||||
|
|
||||||
-- Log trimming if it gets too long
|
-- Log trimming if it gets too long
|
||||||
if fs.size(path) > logFileSizeLimit then
|
if fs.size(path) > logFileSizeLimit then
|
||||||
|
|||||||
Reference in New Issue
Block a user