Skip to content

Commit b5c9b32

Browse files
Christopher MurphyChristopher Murphy
authored andcommitted
fix: Open output directory on macOS.
1 parent 9c0c5ab commit b5c9b32

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

backend/config/config.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import (
99
"optimus/backend/png"
1010
"optimus/backend/webp"
1111
"os"
12+
"os/exec"
1213
"path"
1314
"path/filepath"
15+
goruntime "runtime"
1416
"strconv"
1517

1618
"github.com/wailsapp/wails/v2/pkg/runtime"
@@ -74,10 +76,18 @@ func (c *Config) GetAppConfig() map[string]interface{} {
7476
}
7577
}
7678

77-
// OpenOutputDir opens the output directory using the native system browser.
79+
// OpenOutputDir opens the output directory in the native file manager.
7880
func (c *Config) OpenOutputDir() error {
79-
runtime.BrowserOpenURL(c.ctx, c.App.OutDir)
80-
return nil
81+
var cmd *exec.Cmd
82+
switch goruntime.GOOS {
83+
case "darwin":
84+
cmd = exec.Command("open", c.App.OutDir)
85+
case "windows":
86+
cmd = exec.Command("explorer", c.App.OutDir)
87+
default:
88+
cmd = exec.Command("xdg-open", c.App.OutDir)
89+
}
90+
return cmd.Start()
8191
}
8292

8393
// RestoreDefaults sets the app configuration to defaults.

0 commit comments

Comments
 (0)