fix windows build
This commit is contained in:
parent
e4aac7930f
commit
8b1ca49439
1 changed files with 13 additions and 3 deletions
|
|
@ -61,12 +61,22 @@ impl TorrentStorage for FilesystemStorage {
|
||||||
.context("file is None")?
|
.context("file is None")?
|
||||||
.read_exact_at(buf, offset)?)
|
.read_exact_at(buf, offset)?)
|
||||||
}
|
}
|
||||||
#[cfg(not(target_family = "unix"))]
|
#[cfg(target_family = "windows")]
|
||||||
|
{
|
||||||
|
use std::os::windows::fs::FileExt;
|
||||||
|
let mut remaining = buf.len();
|
||||||
|
let g = of.file.read();
|
||||||
|
let f = g.as_ref().context("file is None")?;
|
||||||
|
f.seek_read(buf, offset)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
#[cfg(not(any(target_family = "unix", target_family = "windows")))]
|
||||||
{
|
{
|
||||||
use std::io::{Read, Seek, SeekFrom};
|
use std::io::{Read, Seek, SeekFrom};
|
||||||
let mut g = of.file.write();
|
let mut g = of.file.write();
|
||||||
g.seek(SeekFrom::Start(offset))?;
|
let mut f = g.as_ref().context("file is None")?;
|
||||||
Ok(g.read_exact(buf)?)
|
f.seek(SeekFrom::Start(offset))?;
|
||||||
|
Ok(f.read_exact(buf)?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue