24 lines
386 B
Go
24 lines
386 B
Go
package backend
|
|
|
|
import (
|
|
"os/exec"
|
|
"runtime"
|
|
)
|
|
|
|
func OpenFolderInExplorer(path string) error {
|
|
var cmd *exec.Cmd
|
|
|
|
switch runtime.GOOS {
|
|
case "windows":
|
|
cmd = exec.Command("explorer", path)
|
|
case "darwin": // macOS
|
|
cmd = exec.Command("open", path)
|
|
case "linux":
|
|
cmd = exec.Command("xdg-open", path)
|
|
default:
|
|
cmd = exec.Command("xdg-open", path)
|
|
}
|
|
|
|
return cmd.Start()
|
|
}
|