Is there a way in Qt to create smth like an auto updater?
-
@mandruk1331
in theUpdates.xml
file you also have the<DownloadableArchives>
entry with the name of all packed archives.Download those and unpack/overwrite the files in your installation folder.
-
@mandruk1331 What do you mean by "pull request"?
-
@ambershark For example: I have an application(old version), a new version is present on my git repository, how I can make my application to check if my git repository has a new version, and if it has one it will download it on Desktop.
-
@mandruk1331 Oh I see, so you want an updater for your application.
That can be a complex topic. There is no Qt way. You would need to develop your own or use a 3rd party solution.
You can use Qt components to make your own (that's what I did).
You can check a webpage (or git) for a newer version. For me that was an xml file I would download, check version differences, etc. If it was new then I would download a package file with the new stuff in it, decompress it, then update my update program (separate exe from my app), launch my update program to update my application. That's pretty much it.
There's also 3rd party application and libs that can help/do this for you. I'll let you google that though since I wrote my own.
-
First of all as others mentioned you should check for the new version by investigating a reply such this :
0.5.19 https://yourarchivesite.com/update/current/data
This reply is a request to some kind of permanent update url that contained update info(version + download link) and could be edited also (for examplehttps://site.com/availableUpdate
).
1.Simply check the version of first part with the version you are running from (in windows it could be query from registry)
2.Download the new version data to a temporary directory
3.Unzip the data (so the newer.exe
is in your temp dir + some other required data)
4.Start a new process (updater.exe
that is located beside your application.exe
) which will close your app -> replace new.exe
with older one -> Update registry info -> delete temp dir -> launch your app back -
The Qt Installer Framework might also be an option.
-
If you want to restart your application after update there is an article in the wiki about that:
https://wiki.qt.io/How_to_make_an_Application_restartableEdit: Well, after a closer look I think it is not enough to just re-instantiate the QApplication if the executable is replaced.
One approach would be to write the application as a generic plugin loader and load all your application components as libraries. Then you can reload specific components after update of the physical DLL file.