From: Steven Barth Date: Thu, 17 Jul 2008 18:09:26 +0000 (+0000) Subject: libs/core: Fixed luci.fs.isfile X-Git-Tag: 0.8.0~634 X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=53a0f9867af86c6732ff39b466fa2e653b29afe9;hp=52d49762ed28033d82e5ab1e0ccf65ad74a4b593 libs/core: Fixed luci.fs.isfile --- diff --git a/libs/core/luasrc/fs.lua b/libs/core/luasrc/fs.lua index 415e8e567..7086088ab 100644 --- a/libs/core/luasrc/fs.lua +++ b/libs/core/luasrc/fs.lua @@ -36,9 +36,7 @@ glob = posix.glob -- Checks whether a file exists function isfile(filename) - local fp = io.open(filename, "r") - if fp then fp:close() end - return fp ~= nil + return posix.stat(filename, "type") == "regular" end -- Returns the content of file