mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
os: handle relative and abs paths in Executable()
This commit is contained in:
@@ -6,5 +6,14 @@ package os
|
||||
func runtime_executable_path() string
|
||||
|
||||
func Executable() (string, error) {
|
||||
return runtime_executable_path(), nil
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user