mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 13:38:43 +00:00
Fix append_to_path
on windows: Use create_if_not_exist
to open the file. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
3f72e9b81a
commit
96d90c0376
1 changed files with 3 additions and 6 deletions
|
@ -95,12 +95,9 @@ pub fn append_to_path<Iter>(path: impl AsRef<Path>, iter: Iter) -> Result<(), Er
|
||||||
where
|
where
|
||||||
Iter: IntoIterator<Item = MetaData>,
|
Iter: IntoIterator<Item = MetaData>,
|
||||||
{
|
{
|
||||||
let mut file = FileLock::new_exclusive(
|
let mut file = FileLock::new_exclusive(create_if_not_exist(path.as_ref())?)?;
|
||||||
fs::OpenOptions::new()
|
// Move the cursor to EOF
|
||||||
.create(true)
|
file.seek(io::SeekFrom::End(0))?;
|
||||||
.append(true)
|
|
||||||
.open(path)?,
|
|
||||||
)?;
|
|
||||||
|
|
||||||
write_to(&mut file, &mut iter.into_iter())
|
write_to(&mut file, &mut iter.into_iter())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue