appro: 添加一些基本判空判断
This commit is contained in:
parent
29b29b1507
commit
b208dddf4f
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user