Explorar o código

Bug fix: was not recognizing some file.

Lee Morgan hai 3 meses
pai
achega
b8c322ffd4
Modificáronse 2 ficheiros con 6 adicións e 14 borrados
  1. 0 7
      src/build_dev.rs
  2. 6 7
      src/routes_map.rs

+ 0 - 7
src/build_dev.rs

@@ -14,11 +14,4 @@ pub fn build_dev(opt: Options) {
 
     let current_dir = env::current_dir().expect("Error");
     let routes = FileType::get_all(current_dir.join(opt.routes_dir));
-
-    println!("something");
-    for route in routes {
-        match route {
-            _ => println!("{:#?}", route)
-        };
-    }
 }

+ 6 - 7
src/routes_map.rs

@@ -20,13 +20,12 @@ impl FileType {
             if path.is_dir() {
                 files.append(&mut FileType::get_all(path));
             } else if path.is_file() {
-                if let Some(filename) = path.file_name() {
-                    let name = filename.to_string_lossy();
-                    if name == "index.html" {
-                        files.push(FileType::HtmlIndex(path))
-                    } else if name == "neovan.html" {
-                        files.push(FileType::NeovanIndex(path))
-                    }
+                let filename = path.file_name().expect("Error reading file").to_string_lossy();
+
+                if filename == "index.html" {
+                    files.push(FileType::HtmlIndex(path))
+                } else if filename == "index.neovan" {
+                    files.push(FileType::NeovanIndex(path))
                 } else if let Some(ext) = path.extension() {
                     if ext == "html" {
                         files.push(FileType::HtmlComponent(path))