[windows] Add debug log for Webview2 version and minimum required version

This commit is contained in:
Lea Anthony
2021-07-16 21:13:34 +10:00
parent 2b69ac8391
commit d574d53fca
2 changed files with 15 additions and 8 deletions

View File

@@ -9,11 +9,18 @@ import (
func (a *App) PreflightChecks(options *options.App) error {
_ = options
// Process the webview2 runtime situation. We can pass a strategy in via the `webview2` flag for `wails build`.
// This will determine how wv2runtime.Process will handle a lack of valid runtime.
err := wv2runtime.Process()
installedVersion, err := wv2runtime.Process()
if installedVersion != nil {
a.logger.Debug("WebView2 Runtime installed: Name: '%s' Version:'%s' Location:'%s'. Minimum version required: %s.",
installedVersion.Name, installedVersion.Version, installedVersion.Location, wv2runtime.MinimumRuntimeVersion)
}
if err != nil {
return err
}
return nil
}

View File

@@ -4,7 +4,7 @@ import (
"github.com/leaanthony/webview2runtime"
)
const minimumRuntimeVersion string = "91.0.864.48"
const MinimumRuntimeVersion string = "91.0.864.48"
type installationStatus int
@@ -14,21 +14,21 @@ const (
installed
)
func Process() error {
func Process() (*webview2runtime.Info, error) {
installStatus := needsInstalling
installedVersion := webview2runtime.GetInstalledVersion()
if installedVersion != nil {
installStatus = installed
updateRequired, err := installedVersion.IsOlderThan(minimumRuntimeVersion)
updateRequired, err := installedVersion.IsOlderThan(MinimumRuntimeVersion)
if err != nil {
_ = webview2runtime.Error(err.Error(), "Error")
return err
return installedVersion, err
}
// Installed and does not require updating
if !updateRequired {
return nil
return installedVersion, nil
}
installStatus = needsUpdating
}
return doInstallationStrategy(installStatus)
return installedVersion, doInstallationStrategy(installStatus)
}