Added files.exists function used in b2c357b03f

This commit is contained in:
Timo Smit 2019-02-12 18:06:29 +01:00
parent b2c357b03f
commit 2d1c7a22f4

View file

@ -36,6 +36,18 @@ function files.ls(directory)
return entries return entries
end end
function files.exists(fileName)
local fileDescriptor, fileLength = et.trap_FS_FOpenFile(fileName, et.FS_READ)
if fileLength ~= -1 then
et.trap_FS_FCloseFile(fileDescriptor)
return true
end
return false
end
function files.loadFromCFG(fileName, idExpr) function files.loadFromCFG(fileName, idExpr)
local fileDescriptor, fileLength = et.trap_FS_FOpenFile(fileName, et.FS_READ) local fileDescriptor, fileLength = et.trap_FS_FOpenFile(fileName, et.FS_READ)