Merge pull request #854 from actionless/use-gio-in-awful-util-is-dir

refactor(awful: util): use lgi.Gio for is_dir
This commit is contained in:
Emmanuel Lepage Vallée 2016-04-28 00:06:11 -04:00
commit 201090100b
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)