Reuse file_infos in a couple places
This commit is contained in:
parent
2e7c7216e3
commit
32d658e2d9
2 changed files with 9 additions and 13 deletions
|
|
@ -151,13 +151,9 @@ impl TorrentStorage for FilesystemStorage {
|
|||
|
||||
fn init(&mut self, meta: &ManagedTorrentShared) -> anyhow::Result<()> {
|
||||
let mut files = Vec::<OpenedFile>::new();
|
||||
for file_details in meta.info.iter_file_details_ext(&meta.lengths)? {
|
||||
for file_details in meta.file_infos.iter() {
|
||||
let mut full_path = self.output_folder.clone();
|
||||
let relative_path = file_details
|
||||
.details
|
||||
.filename
|
||||
.to_pathbuf()
|
||||
.context("error converting file to path")?;
|
||||
let relative_path = &file_details.relative_filename;
|
||||
full_path.push(relative_path);
|
||||
|
||||
std::fs::create_dir_all(full_path.parent().context("bug: no parent")?)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue