refactor(awful: util): use lgi.Gio for is_dir

This commit is contained in:
actionless 2016-04-27 18:28:12 +02:00
parent 58a6cdb440
commit 14f7d20d0f
1 changed files with 1 additions and 10 deletions

View File

@ -253,16 +253,7 @@ end
-- @tparam string path
-- @treturn bool True if path exists and is a directory.
function util.is_dir(path)
local file = io.open(path)
if file then
if not file:read(0) -- Not a regular file (might include empty ones).
and file:seek("end") ~= 0 then -- And not a file with size 0.
io.close(file)
return true
end
io.close(file)
end
return false
return Gio.File.new_for_path(path):query_file_type({}) == "DIRECTORY"
end
local function subset_mask_apply(mask, set)