Fel*_*lix 12 qt auto-update qt-installer
我目前正在使用Qt安装程序框架并设法建立一个在线存储库.我想知道的是:
框架是否提供某种"自动更新"机制,例如每次程序/系统启动时检查更新的插件/服务?
检查更新就足够了,因为安装本身可以使用维护工具完成.
我能找到关于这个主题的所有内容都是这句话:
最终用户可以在初始安装后使用维护工具从服务器安装其他组件,并在服务器上发布更新后立即接收内容的自动更新.
从这里:http://doc.qt.io/qtinstallerframework/ifw-overview.html#choosing-installer-type
谢谢你的帮助!
编辑:建议
基于这个问题的接受回答我创建了一个小型库,使用安装程序框架自动检查更新 - https://github.com/Skycoder42/QtAutoUpdater
小智 19
我所做的是使用QProcess运行维护工具,然后检查输出.它有一种模式,它不运行GUI,但只输出更新信息(如果可用).
请注意,我在应用程序启动时将工作目录设置为应用程序的路径,因此我可以运行maintenancetool.
QProcess process;
process.start("maintenancetool --checkupdates");
// Wait until the update tool is finished
process.waitForFinished();
if(process.error() != QProcess::UnknownError)
{
qDebug() << "Error checking for updates";
return false;
}
// Read the output
QByteArray data = process.readAllStandardOutput();
// No output means no updates available
// Note that the exit code will also be 1, but we don't use that
// Also note that we should parse the output instead of just checking if it is empty if we want specific update info
if(data.isEmpty())
{
qDebug() << "No updates available";
return false;
}
// Call the maintenance tool binary
// Note: we start it detached because this application need to close for the update
QStringList args("--updater");
bool success = QProcess::startDetached("maintenancetool", args);
// Close the application
qApp->closeAllWindows();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4629 次 |
| 最近记录: |