Skip to content

Commit d61646d

Browse files
committed
feat(bootstrapper): uninstall webview2 properly
1 parent 624a1fe commit d61646d

File tree

4 files changed

+18
-23
lines changed

4 files changed

+18
-23
lines changed

cmd/vinegar/bootstrapper_run.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ func (b *bootstrapper) command(args ...string) (*wine.Cmd, error) {
3838
}
3939

4040
func (b *bootstrapper) execute(args ...string) error {
41-
defer gtkutil.IdleAdd(func() {
42-
b.app.RemoveWindow(&b.win.Window)
43-
b.win.SetVisible(false) // Incase bailed out
44-
})
45-
4641
cmd, err := b.command(args...)
4742
if err != nil {
4843
return err

cmd/vinegar/bootstrapper_setup_pfx.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ func (b *bootstrapper) stepSetupDxvk() error {
6666
return nil
6767
}
6868

69-
b.message("Checking DXVK", "version", b.cfg.Studio.DXVK)
70-
7169
new := string(b.cfg.Studio.DXVK)
70+
b.message("Checking DXVK", "version", new)
71+
7272
current, err := dxvk.Version(b.pfx)
7373
if err != nil {
7474
return fmt.Errorf("get version: %w", err)
@@ -89,7 +89,7 @@ func (b *bootstrapper) stepSetupDxvk() error {
8989
}
9090

9191
if err := netutil.DownloadProgress(
92-
dxvk.URL(b.cfg.Studio.DXVK.String()), name, &b.pbar); err != nil {
92+
dxvk.URL(new), name, &b.pbar); err != nil {
9393
return fmt.Errorf("download: %w", err)
9494
}
9595

@@ -118,10 +118,6 @@ func (b *bootstrapper) webviewInstaller() string {
118118
return filepath.Join(dirs.Cache, "webview-"+b.cfg.Studio.WebView+".exe")
119119
}
120120

121-
func (b *bootstrapper) webviewPath() string {
122-
return filepath.Join(b.pfx.Dir(), "drive_c/Program Files (x86)/Microsoft/EdgeWebView/Application", b.cfg.Studio.WebView)
123-
}
124-
125121
func (b *bootstrapper) stepWebviewDownload() error {
126122
name := b.webviewInstaller()
127123
if name == "" {
@@ -145,18 +141,22 @@ func (b *bootstrapper) stepWebviewDownload() error {
145141
}
146142

147143
func (b *bootstrapper) stepWebviewInstall() error {
148-
name := b.webviewInstaller()
149-
path := b.webviewPath()
144+
new := b.cfg.Studio.WebView
145+
b.message("Checking WebView", "version", new)
150146

151-
_, err := os.Stat(path)
152-
if err == nil && name == "" {
153-
b.message("Uninstalling WebView")
154-
155-
return os.RemoveAll(path)
156-
} else if name == "" || (err == nil && name != "") {
147+
current := webview2.Current(b.pfx)
148+
if current != "" && current != b.cfg.Studio.WebView {
149+
b.message("Uninstalling WebView", "current", current, "new", new)
150+
if err := webview2.Uninstall(b.pfx, current); err != nil {
151+
return fmt.Errorf("uninstall: %w", err)
152+
}
153+
}
154+
if current == new || new == "" {
157155
return nil
158156
}
159157

158+
name := b.webviewInstaller()
159+
160160
b.message("Installing WebView", "path", name)
161161
defer b.performing()()
162162

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/lmittmann/tint v1.1.2
1818
github.com/sewnie/rbxbin v0.0.0-20251006114257-d7e318b45616
1919
github.com/sewnie/rbxweb v0.0.0-20250923154144-a174c75bba5d
20-
github.com/sewnie/wine v0.0.0-20251014070639-2dcf49b54017
20+
github.com/sewnie/wine v0.0.0-20251014081238-11b6564ffdf5
2121
)
2222

2323
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ github.com/sewnie/rbxbin v0.0.0-20251006114257-d7e318b45616 h1:saD5MNBSS4LsP7met
2424
github.com/sewnie/rbxbin v0.0.0-20251006114257-d7e318b45616/go.mod h1:Ksjrzt8x1UY2ot2QdDrJXYhTEQOjWH8US0CHgKcH+QY=
2525
github.com/sewnie/rbxweb v0.0.0-20250923154144-a174c75bba5d h1:9+O1OzqsVhNJVPewE7oJqVymRlm+ej8iArdafc7vfKs=
2626
github.com/sewnie/rbxweb v0.0.0-20250923154144-a174c75bba5d/go.mod h1:nSfgVAspLMsixAWAfuTXAjBsiTyMchPxTx+jD3TrM20=
27-
github.com/sewnie/wine v0.0.0-20251014070639-2dcf49b54017 h1:8iezVb+A1dHEnAO632IIF+n/TiSa5I/8zd4IJlVzSWw=
28-
github.com/sewnie/wine v0.0.0-20251014070639-2dcf49b54017/go.mod h1:IbKiMCPd3jWSTrVXxDh4ggy3bvcaNUtI4VnPG9mRYoY=
27+
github.com/sewnie/wine v0.0.0-20251014081238-11b6564ffdf5 h1:SvjAiNZ0l43P5fyJ5hoVRZLFte/uxeDLz2gcjEB0fYY=
28+
github.com/sewnie/wine v0.0.0-20251014081238-11b6564ffdf5/go.mod h1:IbKiMCPd3jWSTrVXxDh4ggy3bvcaNUtI4VnPG9mRYoY=
2929
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
3030
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
3131
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=

0 commit comments

Comments
 (0)