compute "attrs" field

This commit is contained in:
Igor Katson 2024-10-14 15:35:37 +01:00
parent ab173c00f6
commit 2e7c7216e3
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
3 changed files with 5 additions and 1 deletions

View file

@ -1,10 +1,13 @@
use std::path::PathBuf; use std::path::PathBuf;
use librqbit_core::torrent_metainfo::FileDetailsAttrs;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct FileInfo { pub struct FileInfo {
pub relative_filename: PathBuf, pub relative_filename: PathBuf,
pub offset_in_torrent: u64, pub offset_in_torrent: u64,
pub piece_range: std::ops::Range<u32>, pub piece_range: std::ops::Range<u32>,
pub attrs: FileDetailsAttrs,
pub len: u64, pub len: u64,
} }

View file

@ -1149,6 +1149,7 @@ impl Session {
offset_in_torrent: fd.offset, offset_in_torrent: fd.offset,
piece_range: fd.pieces, piece_range: fd.pieces,
len: fd.details.len, len: fd.details.len,
attrs: fd.details.attrs(),
}) })
}) })
.collect::<anyhow::Result<Vec<FileInfo>>>()?; .collect::<anyhow::Result<Vec<FileInfo>>>()?;

View file

@ -181,7 +181,7 @@ where
} }
} }
#[derive(Default)] #[derive(Default, Debug, Clone, Copy)]
pub struct FileDetailsAttrs { pub struct FileDetailsAttrs {
pub symlink: bool, pub symlink: bool,
pub hidden: bool, pub hidden: bool,