Lua: Add FilePath:isExecutableFile()

Change-Id: I1e0984d7cb0ccab6a0092019a3fe133de76c2c77
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-04-18 13:54:35 +02:00
parent aef6e9b87b
commit 3350afeb61
2 changed files with 10 additions and 1 deletions

View File

@@ -70,6 +70,8 @@ return {
[](const FilePath &self) { return self.searchInPath(); }, [](const FilePath &self) { return self.searchInPath(); },
"exists", "exists",
&FilePath::exists, &FilePath::exists,
"isExecutableFile",
&FilePath::isExecutableFile,
"dirEntries", "dirEntries",
[](sol::this_state s, const FilePath &p, sol::table options) -> sol::table { [](sol::this_state s, const FilePath &p, sol::table options) -> sol::table {
sol::state_view lua(s); sol::state_view lua(s);

View File

@@ -12,7 +12,6 @@ function utils.waitms(ms) end
function utils.waitms_cb(ms, callback) end function utils.waitms_cb(ms, callback) end
---@class FilePath ---@class FilePath
---@field exists boolean True if the path exists
utils.FilePath = {} utils.FilePath = {}
---@param path string The path to convert ---@param path string The path to convert
@@ -38,6 +37,14 @@ function utils.FilePath:dirEntries(options) end
---@return string ---@return string
function utils.FilePath:toUserOutput() end function utils.FilePath:toUserOutput() end
---Returns whether the target exists
---@return boolean
function utils.FilePath:exists() end
---Returns whether the target is a file and executable
---@return boolean
function utils.FilePath:isExecutableFile() end
---Returns the path portion of FilePath as a string in the hosts native format ---Returns the path portion of FilePath as a string in the hosts native format
---@return string ---@return string
function utils.FilePath:nativePath() end function utils.FilePath:nativePath() end