5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-13 23:49:35 +08:00
wails/v2/internal/ffenestri/windows/wv2runtime/download.go

36 lines
979 B
Go

// +build !wv2runtime.error
// +build !wv2runtime.browser
// +build !wv2runtime.embed
package wv2runtime
import (
"fmt"
"github.com/leaanthony/webview2runtime"
)
func doInstallationStrategy(installStatus installationStatus) error {
message := "The WebView2 runtime is required. "
if installStatus == needsUpdating {
message = "The Webview2 runtime needs updating. "
}
message += "Press Ok to download and install. Note: The installer will download silently so please wait."
confirmed, err := webview2runtime.Confirm(message, "Missing Requirements")
if err != nil {
return err
}
if !confirmed {
return fmt.Errorf("webview2 runtime not installed")
}
installedCorrectly, err := webview2runtime.InstallUsingBootstrapper()
if err != nil {
_ = webview2runtime.Error(err.Error(), "Error")
return err
}
if !installedCorrectly {
err = webview2runtime.Error("The runtime failed to install correctly. Please try again.", "Error")
return err
}
return nil
}