From: Benny Siegert Date: Fri, 2 Dec 2011 03:29:24 +0000 (+1100) Subject: os/exec: make LookPath always search the current directory under Windows. X-Git-Tag: weekly.2011-12-06~51 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2a876beb1899d875b80285b3032192f9dc6d7670;p=gostls13.git os/exec: make LookPath always search the current directory under Windows. cmd.exe implicitly looks in "." before consulting PATH. LookPath should match this behavior. R=alex.brainman, rsc CC=golang-dev https://golang.org/cl/5434093 --- diff --git a/src/pkg/os/exec/lp_windows.go b/src/pkg/os/exec/lp_windows.go index ef5bd92166..d09e839a39 100644 --- a/src/pkg/os/exec/lp_windows.go +++ b/src/pkg/os/exec/lp_windows.go @@ -63,11 +63,10 @@ func LookPath(file string) (f string, err error) { } return ``, &Error{file, err} } - if pathenv := os.Getenv(`PATH`); pathenv == `` { - if f, err = findExecutable(`.\`+file, exts); err == nil { - return - } - } else { + if f, err = findExecutable(`.\`+file, exts); err == nil { + return + } + if pathenv := os.Getenv(`PATH`); pathenv != `` { for _, dir := range strings.Split(pathenv, `;`) { if f, err = findExecutable(dir+`\`+file, exts); err == nil { return