refactor(awful: util): use lgi.Gio for is_dir
This commit is contained in:
parent
58a6cdb440
commit
14f7d20d0f
|
@ -253,16 +253,7 @@ end
|
||||||
-- @tparam string path
|
-- @tparam string path
|
||||||
-- @treturn bool True if path exists and is a directory.
|
-- @treturn bool True if path exists and is a directory.
|
||||||
function util.is_dir(path)
|
function util.is_dir(path)
|
||||||
local file = io.open(path)
|
return Gio.File.new_for_path(path):query_file_type({}) == "DIRECTORY"
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function subset_mask_apply(mask, set)
|
local function subset_mask_apply(mask, set)
|
||||||
|
|
Loading…
Reference in New Issue