mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 21:18:42 +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
|
||||
Iter: IntoIterator<Item = MetaData>,
|
||||
{
|
||||
let mut file = FileLock::new_exclusive(
|
||||
fs::OpenOptions::new()
|
||||
.create(true)
|
||||
.append(true)
|
||||
.open(path)?,
|
||||
)?;
|
||||
let mut file = FileLock::new_exclusive(create_if_not_exist(path.as_ref())?)?;
|
||||
// Move the cursor to EOF
|
||||
file.seek(io::SeekFrom::End(0))?;
|
||||
|
||||
write_to(&mut file, &mut iter.into_iter())
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue