Skip to content

Commit 6b6fb1c

Browse files
authored
Merge pull request #61 from lowjoel/webview-in-localappdata
Store WebView files on the local cache directory
2 parents a178faf + 3cfc6a3 commit 6b6fb1c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

main.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,16 @@ func main() {
5959
log.Fatal(err.Error())
6060
}
6161

62+
userCacheDir, err := os.UserCacheDir()
63+
if err == nil {
64+
userCacheDir = filepath.Join(userCacheDir, getExeName())
65+
} else {
66+
log.Printf("cannot set user cache dir for Web View: %v", err)
67+
userCacheDir = ""
68+
}
69+
6270
// Create application with options
63-
err := wails.Run(&options.App{
71+
err = wails.Run(&options.App{
6472
Title: AppName,
6573
Width: 900,
6674
Height: 900,
@@ -84,6 +92,7 @@ func main() {
8492
},
8593
// Windows platform specific options
8694
Windows: &windows.Options{
95+
WebviewUserDataPath: userCacheDir,
8796
WebviewIsTransparent: false,
8897
WindowIsTranslucent: false,
8998
DisableWindowIcon: false,

0 commit comments

Comments
 (0)