forked from qt-creator/qt-creator
Lua: Add support for permissions in FilePath class
Change-Id: Ie7fde3f3efe79930ef89715ae43a520583016495 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <QClipboard>
|
||||
#include <QCompleter>
|
||||
#include <QDir>
|
||||
#include <QFileDevice>
|
||||
|
||||
namespace Lua::Internal {
|
||||
|
||||
@@ -110,6 +111,23 @@ void setupQtModule()
|
||||
"NoSort", QDir::NoSort
|
||||
)
|
||||
);
|
||||
|
||||
qt["QFileDevice"] = lua.create_table_with(
|
||||
"Permission", lua.create_table_with(
|
||||
"ReadOwner", QFileDevice::ReadOwner,
|
||||
"ReadUser", QFileDevice::ReadUser,
|
||||
"ReadGroup", QFileDevice::ReadGroup,
|
||||
"ReadOther", QFileDevice::ReadOther,
|
||||
"WriteOwner", QFileDevice::WriteOwner,
|
||||
"WriteUser", QFileDevice::WriteUser,
|
||||
"WriteGroup", QFileDevice::WriteGroup,
|
||||
"WriteOther", QFileDevice::WriteOther,
|
||||
"ExeOwner", QFileDevice::ExeOwner,
|
||||
"ExeUser", QFileDevice::ExeUser,
|
||||
"ExeGroup", QFileDevice::ExeGroup,
|
||||
"ExeOther", QFileDevice::ExeOther
|
||||
)
|
||||
);
|
||||
// clang-format on
|
||||
|
||||
return qt;
|
||||
|
@@ -161,7 +161,15 @@ void setupUtilsModule()
|
||||
"resolvePath",
|
||||
sol::overload(
|
||||
[](const FilePath &p, const QString &path) { return p.resolvePath(path); },
|
||||
[](const FilePath &p, const FilePath &path) { return p.resolvePath(path); }));
|
||||
[](const FilePath &p, const FilePath &path) { return p.resolvePath(path); }),
|
||||
"permissions",
|
||||
[](FilePath& p) {
|
||||
return static_cast<QFileDevice::Permission>(p.permissions().toInt());
|
||||
},
|
||||
"setPermissions",
|
||||
[](FilePath& p, QFileDevice::Permission permissions) {
|
||||
p.setPermissions(static_cast<QFile::Permissions>(permissions));
|
||||
});
|
||||
|
||||
utils["FilePath"]["dirEntries_cb"] = utils["__dirEntries_cb__"];
|
||||
utils["FilePath"]["dirEntries"] = wrap(utils["__dirEntries_cb__"]);
|
||||
|
@@ -92,4 +92,22 @@ qt.QDirIterator = {
|
||||
}
|
||||
}
|
||||
|
||||
qt.QFileDevice = {
|
||||
---@enum Permission
|
||||
Permission = {
|
||||
ReadOwner = 0,
|
||||
ReadUser = 0,
|
||||
ReadGroup = 0,
|
||||
ReadOther = 0,
|
||||
WriteOwner = 0,
|
||||
WriteUser = 0,
|
||||
WriteGroup = 0,
|
||||
WriteOther = 0,
|
||||
ExeOwner = 0,
|
||||
ExeUser = 0,
|
||||
ExeGroup = 0,
|
||||
ExeOther = 0,
|
||||
}
|
||||
}
|
||||
|
||||
return qt
|
||||
|
@@ -89,6 +89,14 @@ function utils.FilePath:completeSuffix() end
|
||||
---@return boolean
|
||||
function utils.FilePath:isAbsolutePath() end
|
||||
|
||||
---Returns the complete OR-ed together combination of permissions for the file.
|
||||
---@return Permission
|
||||
function utils.FilePath:permissions() end
|
||||
|
||||
---Sets permissions for the file.
|
||||
---@param permissions Permission The complete OR-ed together combination of permissions for the file.
|
||||
function utils.FilePath:setPermissions() end
|
||||
|
||||
---@class CommandLine
|
||||
---@field command FilePath The command to execute.
|
||||
---@field arguments string[] The arguments to pass to the command.
|
||||
|
Reference in New Issue
Block a user