PrintToVeraeTimeStamp/cmd/verae-print/open_other.go

25 lines
575 B
Go

//go:build !windows
package main
import (
"os/exec"
"path/filepath"
"runtime"
"github.com/VeraeLLC/PrintToVeraeTimeStamp/internal/settings"
)
// openResult: macOS `open -R` reveals the file in Finder, `open` opens it.
func openResult(mode, cert string) error {
if runtime.GOOS == "darwin" {
if mode == settings.OpenPDF {
return exec.Command("open", cert).Run()
}
return exec.Command("open", "-R", cert).Run()
}
if mode == settings.OpenPDF {
return exec.Command("xdg-open", cert).Start()
}
return exec.Command("xdg-open", filepath.Dir(cert)).Start()
}