// Information specific to a single file inside the MetaInfo structure.
type FileInfo struct {
- Length int64 `bencode:"length"`
- Path []string `bencode:"path"`
+ Length int64 `bencode:"length"`
+ Path []string `bencode:"path"`
+ PathUTF8 []string `bencode:"path.utf-8,omitempty"`
}
func (fi *FileInfo) DisplayPath(info *Info) string {
var offset int64
t.files = new([]*File)
for _, fi := range t.info.UpvertedFiles() {
+ var path []string
+ if len(fi.PathUTF8) != 0 {
+ path = fi.PathUTF8
+ } else {
+ path = fi.Path
+ }
*t.files = append(*t.files, &File{
t,
- strings.Join(append([]string{t.info.Name}, fi.Path...), "/"),
+ strings.Join(append([]string{t.info.Name}, path...), "/"),
offset,
fi.Length,
fi,