Add function to check file executable bit
This is just a plain copy of the file_readable function, with "read" replaced with "execute".
This commit is contained in:
parent
0def266c84
commit
a68cc783c9
|
@ -53,6 +53,17 @@ function filesystem.file_readable(filename)
|
||||||
gfileinfo:get_attribute_boolean("access::can-read")
|
gfileinfo:get_attribute_boolean("access::can-read")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Check if a file exists, is executable and not a directory.
|
||||||
|
-- @tparam string filename The file path.
|
||||||
|
-- @treturn boolean True if file exists and is executable.
|
||||||
|
function filesystem.file_executable(filename)
|
||||||
|
local gfile = Gio.File.new_for_path(filename)
|
||||||
|
local gfileinfo = gfile:query_info("standard::type,access::can-execute",
|
||||||
|
Gio.FileQueryInfoFlags.NONE)
|
||||||
|
return gfileinfo and gfileinfo:get_file_type() ~= "DIRECTORY" and
|
||||||
|
gfileinfo:get_attribute_boolean("access::can-execute")
|
||||||
|
end
|
||||||
|
|
||||||
--- Check if a path exists, is readable and a directory.
|
--- Check if a path exists, is readable and a directory.
|
||||||
-- @tparam string path The directory path.
|
-- @tparam string path The directory path.
|
||||||
-- @treturn boolean True if path exists and is readable.
|
-- @treturn boolean True if path exists and is readable.
|
||||||
|
|
Loading…
Reference in New Issue