VelopackApp class
VelopackApp helps you to handle app activation events correctly.
class VelopackApp
Remarks
This should be used as early as possible in your application startup code. (eg. the beginning of main() or wherever your entry point is) To use this class, you should create a new VelopackApp::Build() builder instance, and then chain calls to the builder to configure your app. Finally, call the Run() method to execute the Velopack logic.
Methods
| Method | Summary |
|---|---|
Build | Create and return a new VelopackApp builder. |
SetLogger | Attach a custom callback to receive log messages from Velopack. |
SetAutoApplyOnStartup | Set whether to automatically apply downloaded updates on startup. This is ON by default. |
SetArgs | Override the command line arguments used by VelopackApp. By default, Velopack will use the command line arguments from the current process. |
SetLocator | Override the default VelopackLocator. The locator is used to find important paths for the application. |
OnAfterInstall | This hook is triggered after the app has been installed. WARNING: This hook is run during critical stages of Velopack operations. Your code will be run and then the process will exit. If your code has not completed within 30 seconds, it will be terminated. Only supported on windows; On other operating systems, this will never be called. |
OnBeforeUninstall | This hook is triggered before the app is uninstalled. WARNING: This hook is run during critical stages of Velopack operations. Your code will be run and then the process will exit. If your code has not completed within 30 seconds, it will be terminated. Only supported on windows; On other operating systems, this will never be called. |
OnBeforeUpdate | This hook is triggered before the app is updated. WARNING: This hook is run during critical stages of Velopack operations. Your code will be run and then the process will exit. If your code has not completed within 30 seconds, it will be terminated. Only supported on windows; On other operating systems, this will never be called. |
OnAfterUpdate | This hook is triggered after the app is updated. WARNING: This hook is run during critical stages of Velopack operations. Your code will be run and then the process will exit. If your code has not completed within 30 seconds, it will be terminated. Only supported on windows; On other operating systems, this will never be called. |
OnFirstRun | This hook is triggered when the application is started for the first time after installation. |
OnRestarted | This hook is triggered when the application is restarted by Velopack after installing updates. |
Run | Runs the Velopack startup logic. This should be the first thing to run in your app. In some circumstances it may terminate/restart the process to perform tasks. |
Build()
static Velopack::VelopackApp Build();
Create and return a new VelopackApp builder.
SetLogger()
Velopack::VelopackApp& SetLogger(vpkc_log_callback_t cbInstall, void* p_user_data);
Attach a custom callback to receive log messages from Velopack.
SetAutoApplyOnStartup()
Velopack::VelopackApp& SetAutoApplyOnStartup(bool bAutoApply);
Set whether to automatically apply downloaded updates on startup. This is ON by default.
SetArgs(args)
Velopack::VelopackApp& SetArgs(std::vector<std::string> const& args);
Override the command line arguments used by VelopackApp. By default, Velopack will use the command line arguments from the current process.
Parameters
| Name | Description |
|---|---|
args | The command line arguments to use. |
Returns A reference to the builder.
SetLocator(locator)
Velopack::VelopackApp& SetLocator(Velopack::VelopackLocatorConfig const& locator);
Override the default VelopackLocator. The locator is used to find important paths for the application.
Parameters
| Name | Description |
|---|---|
locator | The locator to use. |
Returns A reference to the builder.
OnAfterInstall(cbAfterInstall)
Velopack::VelopackApp& OnAfterInstall(vpkc_hook_callback_t cbAfterInstall);
This hook is triggered after the app has been installed. WARNING: This hook is run during critical stages of Velopack operations. Your code will be run and then the process will exit. If your code has not completed within 30 seconds, it will be terminated. Only supported on windows; On other operating systems, this will never be called.
Parameters
| Name | Description |
|---|---|
cbAfterInstall | The callback to run after the app has been installed. |
Returns A reference to the builder.
OnBeforeUninstall(cbBeforeUninstall)
Velopack::VelopackApp& OnBeforeUninstall(vpkc_hook_callback_t cbBeforeUninstall);
This hook is triggered before the app is uninstalled. WARNING: This hook is run during critical stages of Velopack operations. Your code will be run and then the process will exit. If your code has not completed within 30 seconds, it will be terminated. Only supported on windows; On other operating systems, this will never be called.
Parameters
| Name | Description |
|---|---|
cbBeforeUninstall | The callback to run before the app is uninstalled. |
Returns A reference to the builder.
OnBeforeUpdate(cbBeforeUpdate)
Velopack::VelopackApp& OnBeforeUpdate(vpkc_hook_callback_t cbBeforeUpdate);
This hook is triggered before the app is updated. WARNING: This hook is run during critical stages of Velopack operations. Your code will be run and then the process will exit. If your code has not completed within 30 seconds, it will be terminated. Only supported on windows; On other operating systems, this will never be called.
Parameters
| Name | Description |
|---|---|
cbBeforeUpdate | The callback to run before the app is updated. |
Returns A reference to the builder.
OnAfterUpdate(cbAfterUpdate)
Velopack::VelopackApp& OnAfterUpdate(vpkc_hook_callback_t cbAfterUpdate);
This hook is triggered after the app is updated. WARNING: This hook is run during critical stages of Velopack operations. Your code will be run and then the process will exit. If your code has not completed within 30 seconds, it will be terminated. Only supported on windows; On other operating systems, this will never be called.
Parameters
| Name | Description |
|---|---|
cbAfterUpdate | The callback to run after the app is updated. |
Returns A reference to the builder.
OnFirstRun(cbFirstRun)
Velopack::VelopackApp& OnFirstRun(vpkc_hook_callback_t cbFirstRun);
This hook is triggered when the application is started for the first time after installation.
Parameters
| Name | Description |
|---|---|
cbFirstRun | The callback to run when the application is started for the first time. |
Returns A reference to the builder.
OnRestarted(cbRestarted)
Velopack::VelopackApp& OnRestarted(vpkc_hook_callback_t cbRestarted);
This hook is triggered when the application is restarted by Velopack after installing updates.
Parameters
| Name | Description |
|---|---|
cbRestarted | The callback to run when the application is restarted. |
Returns A reference to the builder.
Run(pUserData)
void Run(void* pUserData = 0);
Runs the Velopack startup logic. This should be the first thing to run in your app. In some circumstances it may terminate/restart the process to perform tasks.
Parameters
| Name | Description |
|---|---|
pUserData | A pointer to user data that will be passed to any hooks that are executed. |
Generated from Velopack (C++ headers)