fix(menu): 修复从开始菜单右键添加到桌面的快捷方式无可执行权限问题
This commit is contained in:
parent
0b4b6a129c
commit
523f16bc10
|
@ -146,10 +146,18 @@ void AppContentMenu::addToDesktopAction(QObject *parent, const QString &appId, Q
|
|||
}
|
||||
|
||||
QObject::connect(list.last(), &QAction::triggered, parent, [appId, path] {
|
||||
QFile file(appId);
|
||||
bool ret = file.copy(path);
|
||||
if (ret) {
|
||||
QProcess::startDetached("chmod a+x ", {path});
|
||||
if (QFile::copy(appId, path)) {
|
||||
// 设置权限755
|
||||
// QFile::Permissions permissions(0x0755); // 这也是可以的
|
||||
QFile::Permissions permissions = {
|
||||
QFile::ReadUser | QFile::WriteUser | QFile::ExeUser |
|
||||
QFile::ReadGroup | QFile::ExeGroup |
|
||||
QFile::ReadOther | QFile::ExeOther
|
||||
};
|
||||
|
||||
if (QFile::setPermissions(path, permissions)) {
|
||||
qWarning() << "set file permissions failed, file:" << path;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue