// joinPathComp is a helper that ensures we combine path components with a dot
// when it's appropriate to do so; prefix is the existing prefix and suffix is
// the new component being added.
//
// It returns the joined prefix.
189672
func joinPathComp(prefix, suffix string) string {
	suffix = strings.TrimLeft(suffix, ".")
	if prefix != "" && suffix != "" {
		return prefix + "." + suffix
	}
	return prefix + suffix
}
668909
func hasPathPrefix(s, prefix string) bool {
	switch {
	default:
		return false
	case len(s) == len(prefix):
		return s == prefix
	case len(s) > len(prefix):
		if prefix != "" && prefix[len(prefix)-1] == '/' {
			return strings.HasPrefix(s, prefix)
		}
		return s[len(prefix)] == '/' && s[:len(prefix)] == prefix
	}
}
922803
func (r *Router) subPath(p string) string {
	pre := r.prefix

	if (pre == "/" || pre[:len(pre)-1] == "/") && p[:1] == "/" {
		pre = pre[:len(pre)-1]
	}

	return pre + p
}
466506
func BuildFromPath(path string) (*ServiceTemplate, error) {
	sd, err := servicedefinition.BuildFromPath(path)
	if err != nil {
		return nil, err
	}
	st := ServiceTemplate{
		Services:    []servicedefinition.ServiceDefinition{*sd},
		Name:        sd.Name,
		Version:     sd.Version,
		Description: sd.Description,
	}
	return &st, nil
}
212007
func (rfs *RootFS) Join(elem ...string) string {
	return path.Clean(path.Join(elem...))
}
325427
func (r *SubRouter) Sub(path string) *SubRouter {
	return &SubRouter{
		parent:   r,
		prefix:   r.prefixedRoute(path),
		prefixes: append(r.prefixes, path),
	}
}
1088454
func (s StreamName) Join(o StreamName) StreamPath {
	return StreamPath(fmt.Sprintf("%s%c%c%c%s",
		s.Trim(), StreamNameSep, StreamPathSep, StreamNameSep, o.Trim()))
}
426683
func Join(os string, elem ...string) string {
	if os == "windows" {
		return filepath.Join(elem...)
	}
	return path.Join(elem...)
}
1363031
func JoinSuffixes(src SecurityGroupInfo, dest SecurityGroupInfo) string {
	if src.Suffix == "" && dest.Suffix == "" {
		return ""
	}

	s := src.Suffix
	if s == "" {
		s = "-default"
	}

	d := dest.Suffix
	if d == "" {
		d = "-default"
	}

	return s + d
}
1189927
func BuildFromPath(path string) (*ServiceDefinition, error) {
	sd, err := getServiceDefinition(path)
	if err != nil {
		return nil, err
	}
	return sd, sd.ValidEntity()
}
136288
func URLJoin(baseURL string, paths ...string) (string, error) {
	u, err := url.Parse(baseURL)
	if err != nil {
		return "", err
	}
	// We want path instead of filepath because path always uses /.
	all := []string{u.Path}
	all = append(all, paths...)
	u.Path = path.Join(all...)
	return u.String(), nil
}
936364
func FullJoin(a []string, prefix, sep, suffix string) string {
	if len(a) == 0 {
		return ""
	}

	if len(a) == 1 {
		return prefix + a[0] + suffix
	}

	n := len(prefix) + len(sep) + len(suffix)
	for _, s := range a {
		n += len(s)
	}

	buf := make(bytesp.Slice, 0, n)
	buf.WriteString(prefix)
	buf.WriteString(a[0])
	for _, s := range a[1:] {
		buf.WriteString(sep)
		buf.WriteString(s)
	}
	buf.WriteString(suffix)

	return string(buf)
}
1161932
public static String joinPaths(String prefix, String path, GeneratorRegistry generatorRegistry) {

		return joinPaths(prefix, path, generatorRegistry.isPathGenerated(prefix));
	}
89153
func wrpath(ctxt *Link, b *Biobuf, p string) {
	var i int
	var n int
	if ctxt.Windows == 0 || !strings.Contains(p, `\`) {
		wrstring(b, p)
		return
	}
	n = len(p)
	wrint(b, int64(n))
	for i = 0; i < n; i++ {
		var tmp int
		if p[i] == '\\' {
			tmp = '/'
		} else {
			tmp = int(p[i])
		}
		Bputc(b, tmp)
	}
}
1223558
func (c Context) Join(a []string, sep string) string {
	return strings.Join(a, sep)
}
201452
func ValidateJoinControlPlane(c *kubeadm.JoinControlPlane, fldPath *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}
	if c != nil {
		allErrs = append(allErrs, ValidateAPIEndpoint(&c.LocalAPIEndpoint, fldPath.Child("localAPIEndpoint"))...)
	}
	return allErrs
}
1163384
func (a *Agent) Join(addrs []string, replay bool) (n int, err error) {
	a.logger.Printf("[INFO] agent: joining: %v replay: %v", addrs, replay)
	ignoreOld := !replay
	n, err = a.serf.Join(addrs, ignoreOld)
	if n > 0 {
		a.logger.Printf("[INFO] agent: joined: %d nodes", n)
	}
	if err != nil {
		a.logger.Printf("[WARN] agent: error joining: %v", err)
	}
	return
}