github.com/AlpineAIO/wails/v2@v2.0.0-beta.32.0.20240505041856-1047a8fa5fef/internal/webview2runtime/webview2installer.go (about)

     1  package webview2runtime
     2  
     3  import (
     4  	_ "embed"
     5  	"os"
     6  	"path/filepath"
     7  )
     8  
     9  //go:embed MicrosoftEdgeWebview2Setup.exe
    10  var setupexe []byte
    11  
    12  // WriteInstallerToFile writes the installer file to the given file.
    13  func WriteInstallerToFile(targetFile string) error {
    14  	return os.WriteFile(targetFile, setupexe, 0o755)
    15  }
    16  
    17  // WriteInstaller writes the installer exe file to the given directory and returns the path to it.
    18  func WriteInstaller(targetPath string) (string, error) {
    19  	installer := filepath.Join(targetPath, `MicrosoftEdgeWebview2Setup.exe`)
    20  	return installer, WriteInstallerToFile(installer)
    21  }