From b208dddf4f89c41ff4ced235cc7457d79dc29fc6 Mon Sep 17 00:00:00 2001 From: taynpg Date: Fri, 12 Apr 2024 08:57:49 +0800 Subject: [PATCH] =?UTF-8?q?appro:=20=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E5=88=A4=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MainWidget.cpp | 2 +- adddesktop.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/MainWidget.cpp b/MainWidget.cpp index 09c6529..407bfeb 100644 --- a/MainWidget.cpp +++ b/MainWidget.cpp @@ -7,7 +7,7 @@ MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget) { ui->setupUi(this); - setWindowTitle("packqt v1.0.1"); + setWindowTitle("packqt v1.0.2"); connect_operator(); control_init(); } diff --git a/adddesktop.cpp b/adddesktop.cpp index abd3990..24753b7 100644 --- a/adddesktop.cpp +++ b/adddesktop.cpp @@ -60,6 +60,10 @@ void AddDesktop::install_to_desktop() } std::string binaryPath = ui->edBinary->text().trimmed().toStdString(); + if (binaryPath.empty()) { + MainWidget::message(this, "二进制路径为空"); + return; + } std::string binaryName = fs::path(binaryPath).filename().string(); fs::path sh_path = fs::path(binaryPath).parent_path().append("run.sh"); if (!fs::exists(sh_path)) { @@ -89,6 +93,10 @@ void AddDesktop::install_to_desktop() } else { std::string icn = ui->edIco->text().trimmed().toStdString(); + if (icn.empty()) { + MainWidget::message(this, "图标路径为空"); + return; + } default_ico_path.append(fs::path(icn).filename()); boost::replace_all(ct, "re_icon", default_ico_path.string()); fs::copy_file(icn, default_ico_path, fs::copy_options::overwrite_existing);