use std::fs;
use std::fs::File;
use std::{io, path::Path};
#[cfg(windows)]
pub fn create_file(filename: &Path) -> io::Result<File> {
fs::OpenOptions::new()
.create_new(true)
.write(true)
.read(true)
.custom_flags(winapi::FILE_FLAG_DELETE_ON_CLOSE)
.open(filename)
}
#[cfg(not(windows))]
pub fn create_file(filename: &Path) -> io::Result<File> {
let file = fs::OpenOptions::new()
.create_new(true)
.write(true)
.read(true)
.open(filename)?;
fs::remove_file(filename)?;
Ok(file)
}