// isRestrictedDir determines if the source directory has
// any restrictions placed on it by this configuration.
// A path will be restricted if:
//   - it falls under the base import path
//   - it does not fall under any of the ignored sub-trees
330867
func (i *ImportRestriction) isRestrictedDir(dir string) (bool, error) {
	if under, err := isPathUnder(i.BaseDir, dir); err != nil {
		return false, err
	} else if !under {
		return false, nil
	}

	for _, ignored := range i.IgnoredSubTrees {
		if under, err := isPathUnder(ignored, dir); err != nil {
			return false, err
		} else if under {
			return false, nil
		}
	}

	return true, nil
}
391638
func (r Rule) AllowedPath(requestPath string) bool {
	for _, ignoredSubPath := range r.IgnoredSubPaths {
		if httpserver.Path(path.Clean(requestPath)).Matches(path.Join(r.Path, ignoredSubPath)) {
			return false
		}
	}
	return true
}
1111834
func IsDir(dirPath string) bool {
	fi, err := os.Stat(dirPath)
	if err == nil {
		return fi.IsDir()
	}
	return false
}
867903
func restrictAll(root rpc.Root, err error) *restrictedRoot {
	return restrictRoot(root, func(string, string) error {
		return err
	})
}
80999
func enclosingDir(path string) string {
	for {
		if stat, err := os.Lstat(path); err == nil {
			if stat.IsDir() {
				return path
			}
		}
		if path == "" {
			return ""
		}
		path = filepath.Dir(path)
	}
}
1049215
func (s *Store) IsDir(ctx context.Context, name string) bool {
	name = s.prefix + name
	out.Debug(ctx, "consul.IsDir(%s)", name)
	count := 0
	ls, err := s.List(ctx, name)
	if err != nil {
		return false
	}
	for _, e := range ls {
		if strings.HasPrefix(e, name) {
			count++
		}
	}
	return count > 1
}
1123128
func isDirEntry(e mtree.Entry) bool {
	for _, kw := range e.Keywords {
		kv := mtree.KeyVal(kw)
		if kv.Keyword() == "type" {
			return kv.Value() == "dir"
		}
	}
	// Shouldn't be reached.
	return false
}
2823
func IsVendorDir(dir string) bool {
	return strings.HasPrefix(dir, "vendor/") || strings.Contains(dir, "/vendor/")
}
1115861
func IsDir(path string) bool {
	finfo, err := os.Stat(path)
	switch {
	case err != nil:
		return false
	case finfo.IsDir():
		return true
	default:
		return false
	}
}
630576
func (r *router) Allowed(path, reqMethod string) (allow string) {
	if path == PathAny || path == PathSlashAny { // server-wide
		for method := range r.StaticHandlers {
			if method == methodToIdx(OPTIONS) {
				continue
			}

			// add request method to list of allowed methods
			if len(allow) == 0 {
				allow = methodByIdx(method)
			} else {
				allow += ", " + methodByIdx(method)
			}
		}

		for method := range r.Trees {
			if method == OPTIONS {
				continue
			}

			// add request method to list of allowed methods
			if len(allow) == 0 {
				allow = method
			} else {
				allow += ", " + method
			}
		}
	} else { // specific path
		for method, paths := range r.StaticHandlers {
			// static methods first
			if method == methodToIdx(reqMethod) || method == methodToIdx(OPTIONS) {
				continue
			}

			if hander, ok := paths[path]; ok && hander.handle != nil {
				// add request method to list of allowed methods
				if len(allow) == 0 {
					allow = methodByIdx(method)
				} else {
					allow += ", " + methodByIdx(method)
				}
			}
		}

		for method := range r.Trees {
			// Skip the requested method - we already tried this one
			if method == reqMethod || method == OPTIONS {
				continue
			}

			handle, _, _ := r.Trees[method].GetValue(path, nil, reqMethod)
			if handle != nil {
				// add request method to list of allowed methods
				if len(allow) == 0 {
					allow = method
				} else {
					allow += ", " + method
				}
			}
		}
	}
	if len(allow) > 0 {
		allow += ", OPTIONS"
	}
	return
}
971570
func isExistingDirectory(point *copyEndpoint) (bool, error) {
	destStat, err := point.driver.Stat(point.path)
	switch {
	case os.IsNotExist(err):
		return false, nil
	case err != nil:
		return false, err
	}
	return destStat.IsDir(), nil
}
262565
func IsDir(fpath string) bool {
	d := cleanPath(fpath)
	if fi, err := os.Stat(d); err == nil {
		return fi.IsDir()
	}
	return false
}
15414
func (p Proc) RootDir() (string, error) {
	rdir, err := os.Readlink(p.path("root"))
	if os.IsNotExist(err) {
		return "", nil
	}

	return rdir, err
}
559331
func (r *Router) Allowed(path, reqMethod string) (allow string) {
	return r.router.Allowed(path, reqMethod)
}
713576
func (this *FcmClient) SetRestrictedPackageName(pkg string) *FcmClient {

	this.Message.RestrictedPackageName = pkg

	return this
}
552099
func IsDir(root string) (bool, error) {
	if osutil.DirExists(filepath.Join(root, "sha1")) {
		return true, nil
	}
	if osutil.DirExists(filepath.Join(root, blob.RefFromString("").HashName())) {
		return true, nil
	}
	return false, nil
}
506817
func IsDir(filePath string) bool {
	fi, err := os.Stat(filePath)
	return err == nil && fi.IsDir()
}