|
1 | 1 | use super::config::Config; |
2 | | -use super::format::{self, Extractor, Format, Files}; |
| 2 | +use super::format::{Files, ECAD}; |
3 | 3 | use super::epw::Epw; |
4 | 4 | use super::error::{LLResult, LLError}; |
5 | 5 | use super::cse_result::CSEResult; |
@@ -79,7 +79,7 @@ impl CSE { |
79 | 79 | println!("-- End debug info from {file}#{line} --", file = std::file!(), line = std::line!()); |
80 | 80 | } |
81 | 81 |
|
82 | | - if &self.config.settings.format == &Format::ZIP { |
| 82 | + if &self.config.settings.format.ecad == &ECAD::ZIP { |
83 | 83 |
|
84 | 84 | let mut files: Files = HashMap::new(); |
85 | 85 | files.insert(filename, body); |
@@ -113,17 +113,14 @@ impl CSE { |
113 | 113 | let mut item = archive.by_index(i)?; |
114 | 114 | let filename = String::from(item.name()); |
115 | 115 |
|
116 | | - match &self.config.settings.format { |
117 | | - Format::EAGLE => format::eagle::Extractor::extract(&mut files, filename, &mut item)?, |
118 | | - Format::EASYEDA => format::easyeda::Extractor::extract(&mut files, filename, &mut item)?, |
119 | | - Format::KICAD => format::kicad::Extractor::extract(&mut files, filename, &mut item)?, |
120 | | - Format::ZIP => return Err(LLError::new("This should be unreachable!")) |
121 | | - // ! NOTE: DO NOT ADD A _ => {} CATCHER HERE! |
122 | | - }; |
| 116 | + &self.config.settings.format.extract(&mut files, filename, &mut item)?; |
123 | 117 |
|
124 | 118 | } |
125 | 119 |
|
126 | | - let path = PathBuf::from(&self.config.settings.output_path).join(lib_name); |
| 120 | + let path = match &self.config.settings.format.create_folder { |
| 121 | + true => PathBuf::from(&self.config.settings.output_path).join(lib_name), |
| 122 | + false => PathBuf::from(&self.config.settings.output_path) |
| 123 | + }; |
127 | 124 |
|
128 | 125 | Ok(CSEResult { |
129 | 126 | output_path: path.to_string_lossy().to_string(), |
|
0 commit comments