// RawPath returns escaped url path section
182500
func rawPath(r *http.Request) string {
	// If there are no escape symbols, don't extract raw path
	if !strings.ContainsRune(r.RequestURI, '%') {
		if len(r.URL.Path) == 0 {
			return "/"
		}
		return r.URL.Path
	}
	path := r.RequestURI
	if path == "" {
		path = "/"
	}
	// This is absolute URI, split host and port
	if strings.Contains(path, "://") {
		vals := strings.SplitN(path, r.URL.Host, 2)
		if len(vals) == 2 {
			path = vals[1]
		}
	}
	idx := strings.IndexRune(path, '?')
	if idx == -1 {
		return path
	}
	return path[:idx]
}
78106
func (c *collection) relPath(apiName string) string {
	escapedName := pathEscape(c.name)
	return path.Join(c.db.relPath(), "_api", apiName, escapedName)
}
994828
func (nodePlatform *Platform) ValidatePath(rawPath string) error {
	path, err := url.Parse(rawPath)
	if err != nil || path == nil {
		return fmt.Errorf("invalid path: %s", err)
	}

	//Treat empty scheme as a local filesystem path
	if path.Scheme == "" {
		pathToCheck, err := filepath.Abs(rawPath)
		if err != nil {
			return fmt.Errorf("error obtaining absolute path of the chaincode: %s", err)
		}

		exists, err := pathExists(pathToCheck)
		if err != nil {
			return fmt.Errorf("error validating chaincode path: %s", err)
		}
		if !exists {
			return fmt.Errorf("path to chaincode does not exist: %s", rawPath)
		}
	}
	return nil
}
316185
func (c *Client) raw(method, path string) ([]byte, error) {
	// create the URI
	uri, err := url.Parse(c.ApiUrl + path)
	if err != nil {
		return nil, err
	}

	// add the access token to the URL query string
	params := uri.Query()
	params.Add("access_token", c.Token)
	uri.RawQuery = params.Encode()

	// create the request
	req := &http.Request{
		URL           : uri,
		Method        : method,
		ProtoMajor    : 1,
		ProtoMinor    : 1,
		Close         : true,
		ContentLength : 0,
	}

	// set the appropariate headers
	req.Header = http.Header{}
	req.Header.Set("Content-Type", "application/json")

	// make the request using the default http client
	resp, err := DefaultClient.Do(req)
	if err != nil {
		return nil, err
	}

	// Read the bytes from the body (make sure we defer close the body)
	defer resp.Body.Close()
	return ioutil.ReadAll(resp.Body)
}
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)
	}
}
277599
func (l *WAL) Path() string {
	l.mu.RLock()
	defer l.mu.RUnlock()
	return l.path
}
789088
func (e *Error) RawLine() (line string, available bool, outErr error) {
	if e.Line <= 0 || e.Filename == "<string>" {
		return "", false, nil
	}

	filename := e.Filename
	if e.Template != nil {
		filename = e.Template.set.resolveFilename(e.Template, e.Filename)
	}
	file, err := os.Open(filename)
	if err != nil {
		return "", false, err
	}
	defer func() {
		err := file.Close()
		if err != nil && outErr == nil {
			outErr = err
		}
	}()

	scanner := bufio.NewScanner(file)
	l := 0
	for scanner.Scan() {
		l++
		if l == e.Line {
			return scanner.Text(), true, nil
		}
	}
	return "", false, nil
}
1147189
func (d *database) relPath() string {
	escapedName := pathEscape(d.name)
	return path.Join("_db", escapedName)
}
283041
func Gopath() []string {
	defaultGoPath := runtime.GOROOT()
	if u, err := user.Current(); err == nil {
		defaultGoPath = filepath.Join(u.HomeDir, "go")
	}
	path := Getenv("GOPATH", defaultGoPath)
	paths := strings.Split(path, string(os.PathListSeparator))
	for idx, path := range paths {
		if abs, err := filepath.Abs(path); err == nil {
			paths[idx] = abs
		}
	}
	return paths
}
650444
func (d *Decoder) raw(f *codecFnInfo, rv reflect.Value) {
	urv := (*unsafeReflectValue)(unsafe.Pointer(&rv))
	*(*[]byte)(urv.ptr) = d.rawBytes()
}
1291955
func (s *Store) Path() string {
	if s.url == nil {
		return ""
	}
	return s.url.Path
}
190768
func appendPath(rootPath, childPath string) string {
	return strings.TrimRight(rootPath, "/") + "/" + strings.TrimLeft(childPath, "/")
}
1285146
func (u *URI) Path(path string) string {
	return fmt.Sprintf("%s%s", u.normalize(), path)
}
1320787
func (r ClientRequest) RawPost(path string, payload []byte, f func(*http.Request)) ([]byte, *http.Response, error) {
	url := fmt.Sprintf("%s%s", r.endpoint, path)

	wrapperFunc := func(req *http.Request) {
		if f != nil {
			f(req)
		}

		isArchive := req.Header.Get("content-type") == "application/x-compressed"

		if isArchive && req.ContentLength > 0 && req.Body != nil {
			req.Body = r.fileReporter.TrackUpload(req.ContentLength, req.Body)
		}
	}

	wrapperFunc = r.setContextIDHeader(wrapperFunc)

	resp, err := r.httpClient.PostCustomized(url, payload, wrapperFunc)
	if err != nil {
		return nil, nil, bosherr.WrapErrorf(err, "Performing request POST '%s'", url)
	}

	return r.optionallyFollowResponse(url, resp)
}
525848
func (r *Request) RoutePath() string {
	if r.route != nil {
		return r.route.Path
	}
	return ""
}
454851
func (r *ResourceDefinition) FullPath() string {
	if strings.HasPrefix(r.BasePath, "//") {
		return httppath.Clean(r.BasePath)
	}
	var basePath string
	if p := r.Parent(); p != nil {
		if ca := p.CanonicalAction(); ca != nil {
			if routes := ca.Routes; len(routes) > 0 {
				// Note: all these tests should be true at code generation time
				// as DSL validation makes sure that parent resources have a
				// canonical path.
				basePath = path.Join(routes[0].FullPath())
			}
		}
	} else {
		basePath = Design.BasePath
	}
	return httppath.Clean(path.Join(basePath, r.BasePath))
}
563642
func (s ScriptSort) NestedPath(nestedPath string) ScriptSort {
	s.nestedPath = &nestedPath
	return s
}