Files.Path and .FileInfo change
This commit is contained in:
parent
8f744300cc
commit
bd6d72fa5f
13
client.go
13
client.go
|
@ -37,7 +37,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
filePkg "bitbucket.org/anacrolix/go.torrent/data/file"
|
filePkg "bitbucket.org/anacrolix/go.torrent/data/file"
|
||||||
|
|
||||||
"bitbucket.org/anacrolix/go.torrent/dht"
|
"bitbucket.org/anacrolix/go.torrent/dht"
|
||||||
"bitbucket.org/anacrolix/go.torrent/internal/pieceordering"
|
"bitbucket.org/anacrolix/go.torrent/internal/pieceordering"
|
||||||
"bitbucket.org/anacrolix/go.torrent/iplist"
|
"bitbucket.org/anacrolix/go.torrent/iplist"
|
||||||
|
@ -1672,7 +1671,15 @@ type File struct {
|
||||||
path string
|
path string
|
||||||
offset int64
|
offset int64
|
||||||
length int64
|
length int64
|
||||||
metainfo.FileInfo
|
fi metainfo.FileInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f File) FileInfo() metainfo.FileInfo {
|
||||||
|
return f.fi
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f File) Path() string {
|
||||||
|
return f.path
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f File) ReadAt(p []byte, off int64) (n int, err error) {
|
func (f File) ReadAt(p []byte, off int64) (n int, err error) {
|
||||||
|
@ -1734,7 +1741,7 @@ func (t Torrent) Files() (ret []File) {
|
||||||
for _, fi := range t.Info.UpvertedFiles() {
|
for _, fi := range t.Info.UpvertedFiles() {
|
||||||
ret = append(ret, File{
|
ret = append(ret, File{
|
||||||
t,
|
t,
|
||||||
strings.Join(fi.Path, "/"),
|
strings.Join(append([]string{t.Info.Name}, fi.Path...), "/"),
|
||||||
offset,
|
offset,
|
||||||
fi.Length,
|
fi.Length,
|
||||||
fi,
|
fi,
|
||||||
|
|
Loading…
Reference in New Issue