|
@@ -19,14 +19,15 @@ mod write;
|
19
|
19
|
fn build() {
|
20
|
20
|
let cwd = env::current_dir().expect("Couldn't read current directory");
|
21
|
21
|
|
22
|
|
- match fs::create_dir(cwd.join("public")) {
|
23
|
|
- Ok(_) => {}
|
24
|
|
- Err(err) => match err.kind() {
|
25
|
|
- std::io::ErrorKind::AlreadyExists => {}
|
26
|
|
- _ => panic!(err),
|
27
|
|
- },
|
|
22
|
+ match fs::read_dir(cwd.join("public")) {
|
|
23
|
+ Ok(_) => {
|
|
24
|
+ fs::remove_dir_all(cwd.join("public")).unwrap();
|
|
25
|
+ }
|
|
26
|
+ Err(_) => {}
|
28
|
27
|
}
|
29
|
28
|
|
|
29
|
+ fs::create_dir(cwd.join("public")).expect("Couldn't create public directory");
|
|
30
|
+
|
30
|
31
|
let layout_template = fs::read_to_string(&cwd.join("templates").join("layout.html"))
|
31
|
32
|
.expect("Couldn't find layout template");
|
32
|
33
|
let post_template = fs::read_to_string(cwd.join("templates").join("post.html"))
|