mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-07 12:40:04 +00:00
Refactor: Extract new crate binstalk-manifests (#511)
* Refactor: Extract new crate binstalk-manifests * Fix clippy warning in mod `binstall_crates_v1` * Rm unused deps in binstalk * Update release-pr Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
565be9ae4c
commit
fc6d9ab956
17 changed files with 96 additions and 47 deletions
|
@ -3,20 +3,6 @@ use std::{fs, io, path::Path};
|
|||
use log::debug;
|
||||
use tempfile::NamedTempFile;
|
||||
|
||||
/// Returned file is readable and writable.
|
||||
pub fn create_if_not_exist(path: impl AsRef<Path>) -> io::Result<fs::File> {
|
||||
let path = path.as_ref();
|
||||
|
||||
let mut options = fs::File::options();
|
||||
options.read(true).write(true);
|
||||
|
||||
options
|
||||
.clone()
|
||||
.create_new(true)
|
||||
.open(path)
|
||||
.or_else(|_| options.open(path))
|
||||
}
|
||||
|
||||
/// Atomically install a file.
|
||||
///
|
||||
/// This is a blocking function, must be called in `block_in_place` mode.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue