6 g "github.com/anacrolix/generics"
9 // Information specific to a single file inside the MetaInfo structure.
10 type FileInfo struct {
11 // BEP3. With BEP 47 this can be optional, but we have no way to describe that without breaking
13 Length int64 `bencode:"length"`
14 Path []string `bencode:"path"` // BEP3
15 PathUtf8 []string `bencode:"path.utf-8,omitempty"`
19 // BEP 52. This isn't encoded in a v1 FileInfo, but is exposed here for APIs that expect to deal
21 PiecesRoot g.Option[[32]byte] `bencode:"-"`
22 TorrentOffset int64 `bencode:"-"`
25 func (fi *FileInfo) DisplayPath(info *Info) string {
27 return strings.Join(fi.BestPath(), "/")
29 return info.BestName()
33 func (fi *FileInfo) BestPath() []string {
34 if len(fi.PathUtf8) != 0 {