|
@@ -78,6 +78,17 @@ fn render_post_listing(cwd: &path::PathBuf, layout: &str, posts: &Vec<Post>) {
|
78
|
78
|
|
79
|
79
|
fn main() {
|
80
|
80
|
let cwd = env::current_dir().expect("Couldn't read current directory");
|
|
81
|
+
|
|
82
|
+ match fs::create_dir(cwd.join("public")) {
|
|
83
|
+ Ok(_) => {},
|
|
84
|
+ Err(err) => {
|
|
85
|
+ match err.kind() {
|
|
86
|
+ std::io::ErrorKind::AlreadyExists => {},
|
|
87
|
+ _ => panic!(err)
|
|
88
|
+ }
|
|
89
|
+ }
|
|
90
|
+ }
|
|
91
|
+
|
81
|
92
|
let layout = fs::read_to_string(&cwd.join("templates").join("layout.html"))
|
82
|
93
|
.expect("Couldn't find layout template");
|
83
|
94
|
let post_paths = read_posts_dir(&cwd.join("posts"));
|