Adjusted linux open-code to assume existence of xdg-open.
The current implentation didn't work without a side-by-side file, which somewhat reduces the usefulness of this library. See https://github.com/skratchdot/open-golang/issues/2 .
This commit is contained in:
parent
a09a2535ca
commit
05ac2d7bf3
|
@ -4,15 +4,10 @@ package open
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
|
||||||
"runtime"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func open(input string) *exec.Cmd {
|
func open(input string) *exec.Cmd {
|
||||||
// http://andrewbrookins.com/tech/golang-get-directory-of-the-current-file/
|
return exec.Command("xdg-open", input)
|
||||||
_, file, _, _ := runtime.Caller(1)
|
|
||||||
app := path.Join(path.Dir(file), "..", "vendor", "xdg-open")
|
|
||||||
return exec.Command(app, input)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func openWith(input string, appName string) *exec.Cmd {
|
func openWith(input string, appName string) *exec.Cmd {
|
||||||
|
|
Loading…
Reference in New Issue