Remove consts
This commit is contained in:
parent
da8824a368
commit
a52e4b4dde
1 changed files with 20 additions and 11 deletions
31
src/skel.rs
31
src/skel.rs
|
@ -3,12 +3,6 @@ use std::io;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use thiserror::Error;
|
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)]
|
#[derive(Error, Debug)]
|
||||||
pub enum InitError {
|
pub enum InitError {
|
||||||
#[error("Album directory already initialized - contains a photojawn.conf.yml")]
|
#[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::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");
|
let static_path = album_path.join("static");
|
||||||
fs::create_dir_all(&static_path)?;
|
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");
|
let tmpl_path = album_path.join("_templates");
|
||||||
fs::create_dir_all(tmpl_path)?;
|
fs::create_dir_all(tmpl_path)?;
|
||||||
fs::write(static_path.join("base.html"), BASE_TMPL)?;
|
fs::write(
|
||||||
fs::write(static_path.join("album.html"), ALBUM_TMPL)?;
|
static_path.join("base.html"),
|
||||||
fs::write(static_path.join("photo.html"), PHOTO_TMPL)?;
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue