Fixed log files not being created (fixes #99)

This commit is contained in:
Timo Smit 2020-01-12 21:12:38 +01:00
parent f5da5b151b
commit 506db84674

View file

@ -17,6 +17,7 @@
local players = wolfa_requireModule("players.players") local players = wolfa_requireModule("players.players")
local files = wolfa_requireModule("util.files")
local settings = wolfa_requireModule("util.settings") local settings = wolfa_requireModule("util.settings")
local logs = {} local logs = {}
@ -26,6 +27,12 @@ function logs.writeChat(clientId, type, ...)
return return
end end
if not files.exists(settings.get("g_logChat")) then
local fileDescriptor, _ = et.trap_FS_FOpenFile(settings.get("g_logChat"), et.FS_WRITE)
et.trap_FS_FCloseFile(fileDescriptor)
end
local fileDescriptor, _ = et.trap_FS_FOpenFile(settings.get("g_logChat"), et.FS_APPEND) local fileDescriptor, _ = et.trap_FS_FOpenFile(settings.get("g_logChat"), et.FS_APPEND)
local logLine local logLine
@ -52,6 +59,12 @@ function logs.writeAdmin(clientId, command, victimId, ...)
return return
end end
if not files.exists(settings.get("g_logAdmin")) then
local fileDescriptor, _ = et.trap_FS_FOpenFile(settings.get("g_logAdmin"), et.FS_WRITE)
et.trap_FS_FCloseFile(fileDescriptor)
end
local fileDescriptor, _ = et.trap_FS_FOpenFile(settings.get("g_logAdmin"), et.FS_APPEND) local fileDescriptor, _ = et.trap_FS_FOpenFile(settings.get("g_logAdmin"), et.FS_APPEND)
local logLine local logLine