func GetNestedEntry(ctx context.Context, startingDir fs.Entry, pathElements []string) (fs.Entry, error) {
	current := startingDir

	for _, part := range pathElements {
		if part == "" {
			continue
		}

		dir, ok := current.(fs.Directory)
		if !ok {
			return nil, errors.Errorf("entry not found %q: parent is not a directory", part)
		}

		entries, err := dir.Readdir(ctx)
		if err != nil {
			return nil, errors.Wrap(err, "error reading directory")
		}

		e := entries.FindByName(part)
		if e == nil {
			return nil, errors.Errorf("entry not found: %q", part)
		}

		current = e
	}

	return current, nil
}
// GetNestedEntry returns nested entry with a given name path.
GetNestedEntry returns nested entry with a given name path.
// GetNestedEntry returns nested entry with a given name path .
func GetNestedEntry(ctx context.Context, startingDir fs.Entry, pathElements []string) (fs.Entry, error) {
	current := startingDir
	for _, part := range pathElements {
		if part == "" {
			continue
		}
		dir, ok := current.(fs.Directory)
		if !ok {
			return nil, errors.Errorf("entry not found %q: parent is not a directory", part)
		}
		entries, err := dir.Readdir(ctx)
		if err != nil {
			return nil, errors.Wrap(err, "error reading directory")
		}
		e := entries.FindByName(part)
		if e == nil {
			return nil, errors.Errorf("entry not found: %q", part)
		}
		current = e
	}
	return current, nil
}
func GetNestedEntry ( ctx context . Context , startingDir fs . Entry , pathElements [ ] string ) ( fs . Entry , error ) { current := startingDir for _ , part := range pathElements { if part == " " { continue } dir , ok := current . ( fs . Directory ) if ! ok { return nil , errors . Errorf ( " " , part ) } entries , err := dir . Readdir ( ctx ) if err != nil { return nil , errors . Wrap ( err , " " ) } e := entries . FindByName ( part ) if e == nil { return nil , errors . Errorf ( " " , part ) } current = e } return current , nil }
GetNestedEntry returns nested entry with a given name path.
GetNestedEntry returns nested entry with a given name path .