Remove consts

This commit is contained in:
Nick Pegg 2025-04-27 10:20:27 -07:00
parent da8824a368
commit a52e4b4dde

View file

@ -3,12 +3,6 @@ use std::io;
use std::path::Path;
use thiserror::Error;
const BASE_TMPL: &'static [u8; 653] = include_bytes!("../resources/skel/_templates/base.html");
const ALBUM_TMPL: &'static [u8; 1682] = include_bytes!("../resources/skel/_templates/album.html");
const PHOTO_TMPL: &'static [u8; 1333] = include_bytes!("../resources/skel/_templates/photo.html");
const INDEX_CSS: &'static [u8; 1421] = include_bytes!("../resources/skel/static/index.css");
const BASE_CONFIG: &'static [u8; 315] = include_bytes!("../resources/skel/photojawn.conf.yml");
#[derive(Error, Debug)]
pub enum InitError {
#[error("Album directory already initialized - contains a photojawn.conf.yml")]
@ -24,17 +18,32 @@ pub fn make_skeleton(album_path: &Path) -> Result<(), InitError> {
}
fs::create_dir_all(album_path)?;
fs::write(cfg_path, BASE_CONFIG)?;
fs::write(
cfg_path,
include_bytes!("../resources/skel/photojawn.conf.yml"),
)?;
let static_path = album_path.join("static");
fs::create_dir_all(&static_path)?;
fs::write(static_path.join("index.css"), INDEX_CSS)?;
fs::write(
static_path.join("index.css"),
include_bytes!("../resources/skel/static/index.css"),
)?;
let tmpl_path = album_path.join("_templates");
fs::create_dir_all(tmpl_path)?;
fs::write(static_path.join("base.html"), BASE_TMPL)?;
fs::write(static_path.join("album.html"), ALBUM_TMPL)?;
fs::write(static_path.join("photo.html"), PHOTO_TMPL)?;
fs::write(
static_path.join("base.html"),
include_bytes!("../resources/skel/_templates/base.html"),
)?;
fs::write(
static_path.join("album.html"),
include_bytes!("../resources/skel/_templates/album.html"),
)?;
fs::write(
static_path.join("photo.html"),
include_bytes!("../resources/skel/_templates/photo.html"),
)?;
Ok(())
}