From 6c3ab59c9acdc9528786993f47d225358e8b951a Mon Sep 17 00:00:00 2001 From: curly Date: Tue, 3 Jan 2023 12:53:09 -0700 Subject: almost done probably --- src/main.rs | 64 ++----------------------------------------------------------- 1 file changed, 2 insertions(+), 62 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index a6f8e1f..9f24daf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,66 +7,6 @@ fn main() { Err(n) => {print!("\"settings.toml\": {}: ", n); simple_static_site_generator::Config::new()}, }; - println!("{}", config.get_str("source").unwrap()); - - let mut path_vec = vec![]; - let mut ex_path_vec = vec![]; - - let dirs = fs::read_dir("src").unwrap(); - for dir in dirs { - - let path = dir.as_ref().unwrap().path(); - if path != std::path::PathBuf::from("assets") { - path_vec.push(path); - } else { - ex_path_vec.push(path); - } - } - - println!("INCLUDED"); - for x in &path_vec { - println!("{:?}", x) - } - println!("EXCLUDED"); - for x in &ex_path_vec { - println!("{:?}", x) - } - println!(); - - - // create build directory or panic - simple_static_site_generator::create_dir("build").unwrap(); - - for path in path_vec { - let mut file_string = String::new(); - - if path.is_dir() { - // RECURSE HERE - continue - } - - for line in fs::read_to_string(&path).unwrap().lines() { - if line.contains(":?") { - let v: Vec<&str> = line.trim().split(":?").collect(); - let v = v.get(1).unwrap(); - - println!("INSERTING {} into {:?}", v, path); - - file_string.push_str(fs::read_to_string(v).unwrap().as_ref()); - } else { - file_string.push_str(line); - file_string.push('\n') - } - } - - - let dest = simple_static_site_generator::replace_path_head(&path, "build/"); - - // NEEDS TO CREATE DIRECTORY STRUCTURE - fs::write(dest, file_string).expect("Could not write file"); - - } - - - // NEEDS TO COPY NOT SCANNED DIRECTORIES + // Run + simple_static_site_generator::run(config); } \ No newline at end of file -- cgit v1.2.3