2021-12-13 23:50:38 +00:00
|
|
|
use std::{fs, path::Path, process::Command};
|
|
|
|
|
|
|
|
use color_eyre::Result;
|
|
|
|
|
|
|
|
pub struct Copy;
|
|
|
|
|
|
|
|
impl Copy {
|
|
|
|
pub fn write(
|
|
|
|
build_dir: &Path,
|
|
|
|
public_dir: &Path,
|
|
|
|
source_dir: &Path,
|
|
|
|
) -> Result<()> {
|
|
|
|
let files_to_copy = vec![(
|
|
|
|
source_dir.join("netlify/_redirects"),
|
|
|
|
public_dir.join("_redirects"),
|
|
|
|
)];
|
|
|
|
|
|
|
|
for (source, destination) in files_to_copy {
|
|
|
|
fs::copy(source, destination)?;
|
|
|
|
}
|
|
|
|
|
|
|
|
let dirs_to_copy = vec![
|
2022-03-28 12:06:33 +00:00
|
|
|
(source_dir.join("assets"), &public_dir),
|
2021-12-13 23:50:38 +00:00
|
|
|
(source_dir.join("js"), &public_dir),
|
|
|
|
(build_dir.join("userstyles"), &public_dir),
|
|
|
|
];
|
|
|
|
|
|
|
|
for (source, destination) in dirs_to_copy {
|
|
|
|
Command::new("cp")
|
|
|
|
.arg("-r")
|
|
|
|
.arg(source)
|
|
|
|
.arg(destination)
|
|
|
|
.output()?;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|