use super::prelude::*;
use std::fs;
#[derive(Debug, clap::Args)]
pub struct PlatformOptions {}
pub fn create_dir_all(dst: &Path, _: &Options) -> Result<()> {
fs::create_dir_all(&dst)?;
Ok(())
}
pub fn hard_link(src: &Path, dst: &Path, _: &Options) -> Result<()> {
let _ = remove_file_if_exists(dst);
fs::hard_link(&src, &dst)?;
Ok(())
}
pub fn copy(src: &Path, dst: &Path, _: &Options) -> Result<()> {
let _ = remove_file_if_exists(dst);
fs::copy(&src, &dst)?;
Ok(())
}
fn remove_file_if_exists(path: &Path) -> Result<()> {
if path.exists() {
fs::remove_file(&path)?;
}
Ok(())
}