// Root returns the root element of this Path.
540869
func (p *Path) Root() *Path {
	for ; p.parent != nil; p = p.parent {
		// Do nothing.
	}
	return p
}
1158618
func Key(key ...string) string {
	keychain := append(rootChain, key...)
	str := strings.Join(keychain, "/")
	return str + "/"
}
970970
func (xmlNode *XmlNode) Path() (path string) {
	pathPtr := C.xmlGetNodePath(xmlNode.Ptr)
	if pathPtr != nil {
		p := (*C.char)(unsafe.Pointer(pathPtr))
		defer C.xmlFreeChars(p)
		path = C.GoString(p)
	}
	return
}
598738
func (s *ScheduleExecution) Root(c context.Context) *ds.Key {
	return model.AttemptKeyFromID(c, s.For)
}
447458
func (nb *NodeBuilder) Root() (Node, error) {
	if !nb.done {
		return nil, errors.New(ErrBuilder, errorMessages, "building is not yet done")
	}
	return nb.stack[0], nil
}
114026
func (f *AckFwdDep) Root(c context.Context) *ds.Key {
	return model.AttemptKeyFromID(c, f.Dep.From)
}
247899
func (p *Path) Child(name string, moreNames ...string) *Path {
	r := NewPath(name, moreNames...)
	r.Root().parent = p
	return r
}
725907
func (finder PackageFinder) Root() string {
	if finder.root == "" {
		return os.Getenv("GOPATH")
	}
	return finder.root
}
966595
func (f *Finder) findRoot(ctx context.Context, root *list.Element, parts []string) bool {
	if len(parts) == 0 {
		return false
	}

	ix := len(parts) - 1

	if parts[ix] != "..." {
		return false
	}

	if ix == 0 {
		return true // We already have the Object for root.Path
	}

	// Lookup the Object for the new root.Path
	rootPath := path.Join(root.Path, path.Join(parts[:ix]...))

	ref, err := f.si.FindByInventoryPath(ctx, rootPath)
	if err != nil || ref == nil {
		// If we get an error or fail to match, fall through to find() with the original root and path
		return false
	}

	root.Path = rootPath
	root.Object = ref

	return true
}
405353
func (f *NotifyExecution) Root(c context.Context) *ds.Key {
	return model.ExecutionKeyFromID(c, f.Notification.ID)
}
210799
func (r Root) Find(args ...string) Root {
	temp, ok := findOnce(r.Pointer, args, false, false)
	if ok == false {
		if debug {
			panic("Element `" + args[0] + "` with attributes `" + strings.Join(args[1:], " ") + "` not found")
		}
		return Root{nil, "", errors.New("element `" + args[0] + "` with attributes `" + strings.Join(args[1:], " ") + "` not found")}
	}
	return Root{temp, temp.Data, nil}
}
630503
func (m *GormAreaRepository) Root(ctx context.Context, spaceID uuid.UUID) (*Area, error) {
	defer goa.MeasureSince([]string{"goa", "db", "Area", "root"}, time.Now())
	var rootArea []Area

	rootArea, err := m.Query(FilterBySpaceID(spaceID), func(db *gorm.DB) *gorm.DB {
		return db.Where("space_id = ? AND nlevel(path)=1", spaceID)
	})

	if len(rootArea) != 1 {
		return nil, errors.NewInternalError(ctx, errs.Errorf("single Root area not found for space %s", spaceID))
	}
	if err != nil {
		return nil, err
	}
	return &rootArea[0], nil
}
1124554
func FindProjectroot(path string) (string, error) {
	if path == "" {
		return "", errors.New("project root is blank")
	}
	start := path
	for path != filepath.Dir(path) {
		root := filepath.Join(path, "src")
		if _, err := os.Stat(root); err != nil {
			if os.IsNotExist(err) {
				path = filepath.Dir(path)
				continue
			}
			return "", err
		}
		return path, nil
	}
	return "", fmt.Errorf(`could not find project root in "%s" or its parents`, start)
}
1122763
func (c *Command) Root() *Command {
	if c.HasParent() {
		return c.Parent().Root()
	}
	return c
}
317521
func rootPath(root, path string, cb onSymlinkFunc) (string, error) {
	if path == "" {
		return root, nil
	}
	var linksWalked int // to protect against cycles
	for {
		i := linksWalked
		newpath, err := walkLinks(root, path, &linksWalked, cb)
		if err != nil {
			return "", err
		}
		path = newpath
		if i == linksWalked {
			newpath = filepath.Join("/", newpath)
			if path == newpath {
				return filepath.Join(root, newpath), nil
			}
			path = newpath
		}
	}
}
1327834
func (s *Root) Lookup(ctx context.Context, name string) (fs.Node, error) {
	log.Debugf("Root Lookup: '%s'", name)
	switch name {
	case "mach_kernel", ".hidden", "._.":
		// Just quiet some log noise on OS X.
		return nil, fuse.ENOENT
	}

	p, err := path.ParsePath(name)
	if err != nil {
		log.Debugf("fuse failed to parse path: %q: %s", name, err)
		return nil, fuse.ENOENT
	}

	nd, err := s.Ipfs.Resolver.ResolvePath(ctx, p)
	if err != nil {
		// todo: make this error more versatile.
		return nil, fuse.ENOENT
	}

	switch nd := nd.(type) {
	case *mdag.ProtoNode, *mdag.RawNode:
		return &Node{Ipfs: s.Ipfs, Nd: nd}, nil
	default:
		log.Error("fuse node was not a protobuf node")
		return nil, fuse.ENOTSUP
	}

}
1098665
func (a *AST) GetRoot() AST {
	if a.RootToken {
		return *a
	}

	if len(a.Children) == 0 {
		return AST{}
	}

	return a.Children[0]
}