AUI Framework
develop
Cross-platform base for C++ UI apps
|
Updater class. More...
#include <AUI/Updater/AUpdater.h>
Refer to aui::updater for update process overview.
> All members, including inherited
|
virtual |
Basically about replacing files (no network operations will be performed).
Requires status = StatusWaitingForApplyAndRestart, otherwise has no effect.
Terminates current process with std::exit(0)
You can locate update deployment logs by locating deployment process id (pid). The PID is printed by this function:
Log files location are printed in the beginning of every AUI-based programs (if they use ALogger):
You can now locate the log file by using subprocess' PID printed earlier:
void AUpdater::checkForUpdates | ( | ) |
Requires status = StatusIdle, otherwise has no effect.
|
protectedvirtual |
Called in newly downloaded executable.
Called by downloadUpdateImpl. Updates AUpdate::status progress.
void AUpdater::downloadUpdate | ( | ) |
An implementation might expect to checkForUpdates to be called first.
|
protectedpure virtual |
unpackedUpdateDir | location to unpack an update to. |
Typically implemented as download to temporary dir and unpacking the archive to the specified unpackedUpdateDir.
Unpack your application files to unpackedUpdateDir
. AUpdater is responsible for cleaning this dir in the future.
|
protectedvirtual |
Default implementation guesses installation directory based on
|
protectedvirtual |
Default implementation determines module name using AProcess::self().
The module name is used to construct temporary directory and locate an executable in a downloaded portable.
|
protectedvirtual |
The dir persists between different launches.
|
virtual |
Default implementation deletes AUpdater::getUnpackedUpdateDir() dir.
|
virtual |
applicationArguments | arguments to your program. |
The arguments starting with --aui-updater
are should be ignored by your application.
Performs autoupdate-specific routines on startup of your application. In best scenario, this function should be called by your application as early as possible.
This function might terminate current process with std::exit(0), in case of performing autoupdate routines.
This function will attempt to restore InstallCmdline state (StatusWaitingForApplyAndRestart) via AUpdater::loadInstallCmdline. If the latter succeeds, AUpdate::triggerUpdateOnStartup is called to perform on-startup update.
This function handles following arguments to your application:
--aui-updater-origin
---aui-updater-wait-for-process
- maps to AUpdater::handleWaitForProcess that instructs AUpdater to wait the specified process to finish before processing next argument(s).--aui-updater-cleanup
- maps to AUpdater::handlePostUpdateCleanup and returns control flow to normal execution of your application (last updating step)--aui-updater-failed
- reports last error occurred while update deployment. See AUpdater::getLastDeploymentError().Refer to aui::updater for update process overview.
|
static |
For cases when AUpdater is available see aui::updater
|
protectedvirtual |
AUpdater::handleStartup will try to restore the state via loadInstallCmdline. If InstallCmdline is successfully restored, AUpdater immediately triggers update routine with triggerUpdateOnStartup which exits the application.
The implementation must ensure that subsequent startups would not trigger on-startup update to avoid endless loops in case of failure, i.e, by deleting a file.
|
protected |
By default, installerExecutable is a copy of your application executable. The installation process is triggered via special arguments in installerArguments.
|
protected |
Requires status = StatusDownloading, otherwise has no effect. Updates the value in UI thread.
|
protected |
|
protectedvirtual |
|
protectedvirtual |
The function is called by AUpdater::handleStartup. If triggerUpdateOnStartup succeeds, it should terminate execution of the current process.
Requires status = StatusWaitingForApplyAndRestart.
If you'd like to disable applying downloaded update on startup, stub this function.
AProperty<std::any> AUpdater::status |
Status of the AUpdater to observe from outside, i.e., by UI.
status
is updated in UI thread only.
status
is designed in such a way the user can use their own custom status types or any of predefined ones:
These statuses might be set by AUpdater itself.
Typical observer of status is a UI projection displaying its value. You can even display controls in it: