Update kardianos/osext (ref #1272)

This commit is contained in:
Jakob Borg 2015-12-22 09:39:47 +01:00
parent 435afa0eea
commit 37aa89b19d
3 changed files with 13 additions and 5 deletions

4
Godeps/Godeps.json generated
View File

@ -1,6 +1,6 @@
{
"ImportPath": "github.com/syncthing/syncthing",
"GoVersion": "go1.5.1",
"GoVersion": "go1.5.2",
"Packages": [
"./cmd/..."
],
@ -31,7 +31,7 @@
},
{
"ImportPath": "github.com/kardianos/osext",
"Rev": "345163ffe35aa66560a4cd7dddf00f3ae21c9fda"
"Rev": "431e263e413efe4446ede50cec4819b26659fbe7"
},
{
"ImportPath": "github.com/rcrowley/go-metrics",

View File

@ -7,12 +7,18 @@ package osext
import "path/filepath"
var cx, ce = executableClean()
func executableClean() (string, error) {
p, err := executable()
return filepath.Clean(p), err
}
// Executable returns an absolute path that can be used to
// re-invoke the current program.
// It may not be valid after the current program exits.
func Executable() (string, error) {
p, err := executable()
return filepath.Clean(p), err
return cx, ce
}
// Returns same path as Executable, returns just the folder

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build linux netbsd solaris dragonfly
// +build linux netbsd solaris dragonfly freebsd
package osext
@ -27,6 +27,8 @@ func executable() (string, error) {
return execpath, nil
case "netbsd":
return os.Readlink("/proc/curproc/exe")
case "freebsd":
return os.Readlink("/proc/curproc/file")
case "dragonfly":
return os.Readlink("/proc/curproc/file")
case "solaris":