use std::io;
use std::process::{Command, Stdio};
pub fn run_cross_platform(cmd: &str) -> io::Result<()> {
#[cfg(target_os = "windows")]
let mut command = Command::new("cmd");
#[cfg(target_os = "windows")]
command.arg("/C");
#[cfg(not(target_os = "windows"))]
let mut command = Command::new("sh");
#[cfg(not(target_os = "windows"))]
command.arg("-c");
command
.arg(cmd)
.stdin(Stdio::inherit())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.status()?;
Ok(())
}
use std::path::Path;
use std::{fs};
pub fn copy_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> io::Result<()> {
fs::create_dir_all(&dst)?;
for entry in fs::read_dir(src)? {
let entry = entry?;
let ty = entry.file_type()?;
if ty.is_dir() {
copy_dir_all(entry.path(), dst.as_ref().join(entry.file_name()))?;
} else {
fs::copy(entry.path(), dst.as_ref().join(entry.file_name()))?;
}
}
Ok(())
}