// relPath creates the relative path to this view (`_db/<db-name>/_api/view/<view-name>`)
513639
func (v *view) relPath() string {
	escapedName := pathEscape(v.name)
	return path.Join(v.db.relPath(), "_api", "view", escapedName)
}
1285146
func (u *URI) Path(path string) string {
	return fmt.Sprintf("%s%s", u.normalize(), path)
}
274994
func resolvePath(base, ref string) string {
	var full string
	if ref == "" {
		full = base
	} else if ref[0] != '/' {
		i := strings.LastIndex(base, "/")
		full = base[:i+1] + ref
	} else {
		full = ref
	}
	if full == "" {
		return ""
	}
	var dst []string
	src := strings.Split(full, "/")
	for _, elem := range src {
		switch elem {
		case ".":
			// drop
		case "..":
			if len(dst) > 0 {
				dst = dst[:len(dst)-1]
			}
		default:
			dst = append(dst, elem)
		}
	}
	if last := src[len(src)-1]; last == "." || last == ".." {
		// Add final slash to the joined path.
		dst = append(dst, "")
	}
	return "/" + strings.TrimLeft(strings.Join(dst, "/"), "/")
}
205708
func (r *RepositoryLicense) GetPath() string {
	if r == nil || r.Path == nil {
		return ""
	}
	return *r.Path
}
1312687
func (f FileSystem) GetFullPath(url string, option *Option) (path string, err error) {
	if option != nil && option.Get("path") != "" {
		path = filepath.Join(option.Get("path"), url)
	} else {
		path = filepath.Join("./public", url)
	}

	dir := filepath.Dir(path)
	if _, err := os.Stat(dir); os.IsNotExist(err) {
		err = os.MkdirAll(dir, os.ModePerm)
	}

	return
}
982147
func (r *Request) Path(path string) *Request {
	r.Use(url.Path(path))
	return r
}
453662
func (e *V1Endpoint) Path(path string) string {
	return e.URL.String() + "/v1/" + path
}
643090
func (u Util) JoinPath(path ...string) (string, error) {
	components := []string{}
	for _, tmp := range path {
		components = append(components, SplitPath(tmp)...)
	}
	last := components[len(components)-1]
	components = components[:len(components)-1]

	realpath := "/"
	for _, component := range components {
		tmp := filepath.Join(realpath, component)
		s, err := os.Lstat(filepath.Join(u.DestDir, tmp))
		if os.IsNotExist(err) {
			realpath = tmp
			continue
		} else if err != nil {
			return "", err
		}

		if s.Mode()&os.ModeSymlink == 0 {
			realpath = tmp
			continue
		}

		symlinkPath, err := os.Readlink(filepath.Join(u.DestDir, tmp))
		if err != nil {
			return "", err
		}
		if filepath.IsAbs(symlinkPath) {
			realpath = "/"
		}
		realpath = filepath.Join(realpath, symlinkPath)
	}

	return filepath.Join(u.DestDir, realpath, last), nil
}
1306498
func RawPath(in string) (string, error) {
	u, err := url.ParseRequestURI(in)
	if err != nil {
		return "", err
	}
	path := ""
	if u.Opaque != "" {
		path = u.Opaque
	} else if u.Host == "" {
		path = in
	} else {
		vals := strings.SplitN(in, u.Host, 2)
		if len(vals) != 2 {
			return "", fmt.Errorf("failed to parse url")
		}
		path = vals[1]
	}
	idx := strings.IndexRune(path, '?')
	if idx == -1 {
		return path, nil
	}
	return path[:idx], nil
}
86876
func CleanURLPath(p string) string {
	if p == "" {
		return "/"
	}
	if p[0] != '/' {
		p = "/" + p
	}
	cp := path.Clean(p)
	// Add the trailing slash back, as it's relevant to a URL.
	if p[len(p)-1] == '/' && cp != "/" {
		cp += "/"
	}
	return cp
}
792958
func (r *ResponseMatcher) Path(p string) *ResponseMatcher {
	r.mux.mu.Lock()
	defer r.mux.mu.Unlock()
	r.path = p
	return r
}
694217
func Path(path string) option {
	return func(c *sass) error {
		c.srcFile = path
		c.ctx.MainFile = path
		return nil
	}
}
930734
func rel(basepath, targpath string) (string, error) {
	// filepath.Rel can't handle UUID paths in windows
	if runtime.GOOS == "windows" {
		pfx := basepath + `\`
		if strings.HasPrefix(targpath, pfx) {
			p := strings.TrimPrefix(targpath, pfx)
			if p == "" {
				p = "."
			}
			return p, nil
		}
	}
	return filepath.Rel(basepath, targpath)
}
1267514
func (d *BundlesDir) bundleURLPath(url *charm.URL) string {
	return path.Join(d.path, charm.Quote(url.String()))
}
960756
func (u *user) relPath() string {
	escapedName := pathEscape(u.data.Name)
	return path.Join("_api", "user", escapedName)
}
219809
func (g *graph) relPath() string {
	escapedName := pathEscape(g.name)
	return path.Join(g.db.relPath(), "_api", "gharial", escapedName)
}
27777
func v1APIPath(path string) string {
	if !strings.HasPrefix(path, "/") {
		path = V1APIPrefix + path
	}
	return (&url.URL{Path: path}).String()
}