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 // Unofficial extension by BiglyBT? https://github.com/BiglySoftware/BiglyBT/issues/1274. Might
16 // be a safer bet when available: https://github.com/anacrolix/torrent/pull/915.
17 PathUtf8 []string `bencode:"path.utf-8,omitempty"`
21 // BEP 52. This isn't encoded in a v1 FileInfo, but is exposed here for APIs that expect to deal
23 PiecesRoot g.Option[[32]byte] `bencode:"-"`
24 TorrentOffset int64 `bencode:"-"`
27 func (fi *FileInfo) DisplayPath(info *Info) string {
29 return strings.Join(fi.BestPath(), "/")
31 return info.BestName()
35 func (fi *FileInfo) BestPath() []string {
36 if len(fi.PathUtf8) != 0 {