awful.util: new function file_readable()
Signed-off-by: koniu <gkusnierz@gmail.com>
This commit is contained in:
parent
0358d1085d
commit
92fd31b7f5
|
@ -156,4 +156,17 @@ function getdir(d)
|
||||||
return os.getenv("HOME").."/.cache/awesome"
|
return os.getenv("HOME").."/.cache/awesome"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Check if file exists and is readable.
|
||||||
|
-- @param filename The file path
|
||||||
|
-- @return True if file exists and readable.
|
||||||
|
function file_readable(filename)
|
||||||
|
local file = io.open(filename)
|
||||||
|
if file then
|
||||||
|
io.close(file)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
Loading…
Reference in New Issue