mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-10 22:49:30 +00:00
20 lines
341 B
Go
20 lines
341 B
Go
//go:build darwin
|
|
|
|
package os
|
|
|
|
// via runtime because we need argc/argv ptrs
|
|
func runtime_executable_path() string
|
|
|
|
func Executable() (string, error) {
|
|
p := runtime_executable_path()
|
|
if p != "" && p[0] == '/' {
|
|
// absolute path
|
|
return p, nil
|
|
}
|
|
cwd, err := Getwd()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return joinPath(cwd, p), nil
|
|
}
|