OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 The Go Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style |
| 3 // license that can be found in the LICENSE file. |
| 4 |
| 5 package os |
| 6 |
| 7 var progPath string // set by ../runtime/progpath_darwin.c |
| 8 |
| 9 var initCwd, initCwdErr = Getwd() |
| 10 |
| 11 func executable() (string, error) { |
| 12 if progPath[0] != '/' { |
| 13 if initCwdErr != nil { |
| 14 return progPath, initCwdErr |
| 15 } else { |
| 16 if progPath[0] == '.' { |
| 17 // skip "./" |
| 18 progPath = progPath[2:] |
| 19 } |
| 20 return initCwd + "/" + progPath, nil |
| 21 } |
| 22 } |
| 23 return progPath, nil |
| 24 } |
OLD | NEW |