Source file
src/os/executable_solaris.go
1
2
3
4
5 package os
6
7 import "syscall"
8
9 var executablePath string
10
11 var initCwd, initCwdErr = Getwd()
12
13 func executable() (string, error) {
14 path := executablePath
15 if len(path) == 0 {
16 path, err := syscall.Getexecname()
17 if err != nil {
18 return path, err
19 }
20 }
21 if len(path) > 0 && path[0] != '/' {
22 if initCwdErr != nil {
23 return path, initCwdErr
24 }
25 if len(path) > 2 && path[0:2] == "./" {
26
27 path = path[2:]
28 }
29 return initCwd + "/" + path, nil
30 }
31 return path, nil
32 }
33
View as plain text