添加安装到菜单栏时添加权限
This commit is contained in:
parent
da67e39364
commit
ee51cba780
@ -7,7 +7,7 @@
|
|||||||
MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget)
|
MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowTitle("packqt v1.0.3");
|
setWindowTitle("packqt v1.0.4");
|
||||||
connect_operator();
|
connect_operator();
|
||||||
control_init();
|
control_init();
|
||||||
}
|
}
|
||||||
@ -310,4 +310,4 @@ bool MainWidget::add_run_sh(const std::string& out_dir, const std::string& exe_n
|
|||||||
out.close();
|
out.close();
|
||||||
cmd_exec(std::string("chmod +x " + out_sh));
|
cmd_exec(std::string("chmod +x " + out_sh));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ AddDesktop::AddDesktop(QWidget* parent) : QDialog(parent), ui(new Ui::AddDesktop
|
|||||||
connect(ui->btnSelectBinary, &QPushButton::clicked, this,
|
connect(ui->btnSelectBinary, &QPushButton::clicked, this,
|
||||||
[=]() { MainWidget::SelectFile(this, ui->edBinary, "请选择二进制文件", "所有文件 (*)"); });
|
[=]() { MainWidget::SelectFile(this, ui->edBinary, "请选择二进制文件", "所有文件 (*)"); });
|
||||||
connect(ui->btnSelectIco, &QPushButton::clicked, this,
|
connect(ui->btnSelectIco, &QPushButton::clicked, this,
|
||||||
[=]() { MainWidget::SelectFile(this, ui->edIco, "请选择ico图标文件", "ico图标(*.ico);;svg图标(*.svg);;所有文件 (*)"); });
|
[=]() { MainWidget::SelectFile(this, ui->edIco, "请选择ico图标文件", "png图标(*.png);;ico图标(*.ico);;svg图标(*.svg);;所有文件 (*)"); });
|
||||||
connect(ui->btnInstall, &QPushButton::clicked, this, &AddDesktop::install_to_desktop);
|
connect(ui->btnInstall, &QPushButton::clicked, this, &AddDesktop::install_to_desktop);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +66,12 @@ void AddDesktop::install_to_desktop()
|
|||||||
}
|
}
|
||||||
std::string binaryName = fs::path(binaryPath).filename().string();
|
std::string binaryName = fs::path(binaryPath).filename().string();
|
||||||
fs::path sh_path = fs::path(binaryPath).parent_path().append(binaryName + ".sh");
|
fs::path sh_path = fs::path(binaryPath).parent_path().append(binaryName + ".sh");
|
||||||
|
|
||||||
|
std::string cmodBin = "chmod +x " + binaryPath;
|
||||||
|
std::string cmodSh = "chmod +x " + sh_path.string();
|
||||||
|
MainWidget::cmd_exec(cmodBin);
|
||||||
|
MainWidget::cmd_exec(cmodSh);
|
||||||
|
|
||||||
if (!fs::exists(sh_path)) {
|
if (!fs::exists(sh_path)) {
|
||||||
MainWidget::add_run_sh(sh_path.parent_path().string(), binaryName);
|
MainWidget::add_run_sh(sh_path.parent_path().string(), binaryName);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user