From 1bb1a8015659e0cfde45be9fe9440dbb254680cf Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Tue, 2 Jul 2019 18:21:34 -0400 Subject: Use "open" instead of "xdg-open" on Darwin systems --- lib/open.go | 12 ++++++++++++ lib/open_darwin.go | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 lib/open.go create mode 100644 lib/open_darwin.go (limited to 'lib') diff --git a/lib/open.go b/lib/open.go new file mode 100644 index 0000000..ad6533e --- /dev/null +++ b/lib/open.go @@ -0,0 +1,12 @@ +// +build !darwin + +package lib + +import ( + "os/exec" +) + +func OpenFile(filename string) error { + cmd := exec.Command("xdg-open", filename) + return cmd.Run() +} diff --git a/lib/open_darwin.go b/lib/open_darwin.go new file mode 100644 index 0000000..0ffd9a1 --- /dev/null +++ b/lib/open_darwin.go @@ -0,0 +1,10 @@ +package lib + +import ( + "os/exec" +) + +func OpenFile(filename string) error { + cmd := exec.Command("open", filename) + return cmd.Run() +} -- cgit 1.4.1-2-gfad0