|
@@ -256,13 +256,12 @@ fn main() -> Result<(), Box<dyn error::Error + 'static>> {
|
|
|
header_path.push("header.html");
|
|
|
|
|
|
let header_content = read_file_string(&header_path)
|
|
|
- .unwrap_or("<html><head><title>{title}</title><body>".to_owned());
|
|
|
+ .unwrap_or("<html><head><title>{title}</title><body>".to_owned());
|
|
|
|
|
|
let mut footer_path = PathBuf::new();
|
|
|
footer_path.push("footer.html");
|
|
|
|
|
|
- let footer_content = read_file_string(&footer_path)
|
|
|
- .unwrap_or("</body></html>".to_owned());
|
|
|
+ let footer_content = read_file_string(&footer_path).unwrap_or("</body></html>".to_owned());
|
|
|
|
|
|
for file in files {
|
|
|
println!("[info] Processing file {}", file.to_str().unwrap());
|
|
@@ -281,26 +280,29 @@ fn main() -> Result<(), Box<dyn error::Error + 'static>> {
|
|
|
path.push("assets.config");
|
|
|
|
|
|
let assets: Vec<PathBuf> = read_file_string(&path)
|
|
|
- .unwrap_or("".to_owned())
|
|
|
- .split("\n")
|
|
|
- .skip_while(|e| e == &"")
|
|
|
- .map(|line| {
|
|
|
- let buf = Path::new(line.trim()).to_path_buf();
|
|
|
- buf.canonicalize().unwrap_or(buf)
|
|
|
- })
|
|
|
- .collect();
|
|
|
+ .unwrap_or("".to_owned())
|
|
|
+ .split("\n")
|
|
|
+ .skip_while(|e| e == &"")
|
|
|
+ .map(|line| {
|
|
|
+ let buf = Path::new(line.trim()).to_path_buf();
|
|
|
+ buf.canonicalize().unwrap_or(buf)
|
|
|
+ })
|
|
|
+ .collect();
|
|
|
|
|
|
println!("[info] Copying {} assets...", assets.len());
|
|
|
|
|
|
for asset in &assets {
|
|
|
let destination = destination_for_file(&arguments, &asset)?;
|
|
|
|
|
|
- println!("[info] Copying '{}'\n \tto '{}'.", asset.to_str().unwrap(), destination.to_str().unwrap());
|
|
|
+ println!(
|
|
|
+ "[info] Copying '{}'\n \tto '{}'.",
|
|
|
+ asset.to_str().unwrap(),
|
|
|
+ destination.to_str().unwrap()
|
|
|
+ );
|
|
|
|
|
|
create_output_file_path(&destination)?;
|
|
|
|
|
|
- let _ = fs::copy(&asset, &destination)
|
|
|
- .map_err(|error| {
|
|
|
+ let _ = fs::copy(&asset, &destination).map_err(|error| {
|
|
|
println!(
|
|
|
"[error] Could not copy asset '{}'. Error: ",
|
|
|
error.to_string()
|