src/server/pkg/exec/exec.go
func lookExtensions(path, dir string) (string, error) {
	if filepath.Base(path) == path {
		path = filepath.Join(".", path)
	}
	if dir == "" {
		return exec.LookPath(path)
	}
	if filepath.VolumeName(path) != "" {
		return exec.LookPath(path)
	}
	if len(path) > 1 && os.IsPathSeparator(path[0]) {
		return exec.LookPath(path)
	}
	dirandpath := filepath.Join(dir, path)
	// We assume that LookPath will only add file extension.
	lp, err := exec.LookPath(dirandpath)
	if err != nil {
		return "", err
	}
	ext := strings.TrimPrefix(lp, dirandpath)
	return path + ext, nil
}
func lookExtensions(path, dir string) (string, error) {
	if filepath.Base(path) == path {
		path = filepath.Join(".", path)
	}
	if dir == "" {
		return exec.LookPath(path)
	}
	if filepath.VolumeName(path) != "" {
		return exec.LookPath(path)
	}
	if len(path) > 1 && os.IsPathSeparator(path[0]) {
		return exec.LookPath(path)
	}
	dirandpath := filepath.Join(dir, path)
	// We assume that LookPath will only add file extension.
	lp, err := exec.LookPath(dirandpath)
	if err != nil {
		return "", err
	}
	ext := strings.TrimPrefix(lp, dirandpath)
	return path + ext, nil
}
func lookExtensions ( path , dir string ) ( string , error ) { if filepath . Base ( path ) == path { path = filepath . Join ( " " , path ) } if dir == " " { return exec . LookPath ( path ) } if filepath . VolumeName ( path ) != " " { return exec . LookPath ( path ) } if len ( path ) > 1 && os . IsPathSeparator ( path [ 0 ] ) { return exec . LookPath ( path ) } dirandpath := filepath . Join ( dir , path ) // We assume that LookPath will only add file extension. lp , err := exec . LookPath ( dirandpath ) if err != nil { return " " , err } ext := strings . TrimPrefix ( lp , dirandpath ) return path + ext , nil }
// lookExtensions finds windows executable by its dir and path.
// It uses LookPath to try appropriate extensions.
// lookExtensions does not search PATH, instead it converts `prog` into `.\prog`.
lookExtensions finds windows executable by its dir and path . It uses LookPath to try appropriate extensions . lookExtensions does not search PATH instead it converts prog into . \ prog .