mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-13 23:49:35 +08:00
36 lines
849 B
Go
36 lines
849 B
Go
package wv2runtime
|
|
|
|
import (
|
|
"github.com/leaanthony/go-webview2/webviewloader"
|
|
"github.com/leaanthony/webview2runtime"
|
|
)
|
|
|
|
const MinimumRuntimeVersion string = "91.0.864.48"
|
|
|
|
type installationStatus int
|
|
|
|
const (
|
|
needsInstalling installationStatus = iota
|
|
needsUpdating
|
|
installed
|
|
)
|
|
|
|
func Process() (*webview2runtime.Info, error) {
|
|
installStatus := needsInstalling
|
|
installedVersion := webview2runtime.GetInstalledVersion()
|
|
if installedVersion != nil {
|
|
installStatus = installed
|
|
compareResult, err := webviewloader.CompareBrowserVersions(installedVersion.Version, MinimumRuntimeVersion)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
updateRequired := compareResult == -1
|
|
// Installed and does not require updating
|
|
if !updateRequired {
|
|
return installedVersion, nil
|
|
}
|
|
|
|
}
|
|
return installedVersion, doInstallationStrategy(installStatus)
|
|
}
|