use path.utf8 first for some torrent (#350)
This commit is contained in:
parent
6e95274413
commit
790ba6af3c
|
@ -4,8 +4,9 @@ import "strings"
|
||||||
|
|
||||||
// Information specific to a single file inside the MetaInfo structure.
|
// Information specific to a single file inside the MetaInfo structure.
|
||||||
type FileInfo struct {
|
type FileInfo struct {
|
||||||
Length int64 `bencode:"length"`
|
Length int64 `bencode:"length"`
|
||||||
Path []string `bencode:"path"`
|
Path []string `bencode:"path"`
|
||||||
|
PathUTF8 []string `bencode:"path.utf-8,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fi *FileInfo) DisplayPath(info *Info) string {
|
func (fi *FileInfo) DisplayPath(info *Info) string {
|
||||||
|
|
8
t.go
8
t.go
|
@ -189,9 +189,15 @@ func (t *Torrent) initFiles() {
|
||||||
var offset int64
|
var offset int64
|
||||||
t.files = new([]*File)
|
t.files = new([]*File)
|
||||||
for _, fi := range t.info.UpvertedFiles() {
|
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.files = append(*t.files, &File{
|
||||||
t,
|
t,
|
||||||
strings.Join(append([]string{t.info.Name}, fi.Path...), "/"),
|
strings.Join(append([]string{t.info.Name}, path...), "/"),
|
||||||
offset,
|
offset,
|
||||||
fi.Length,
|
fi.Length,
|
||||||
fi,
|
fi,
|
||||||
|
|
Loading…
Reference in New Issue