(&mut self)
| 39 | } |
| 40 | |
| 41 | pub fn run(&mut self) { |
| 42 | loop { |
| 43 | match self.msg.recv() { |
| 44 | Ok(GuiRequest::ChooseFolder) => { |
| 45 | let path = self.gui.choose_folder().recv().ok().flatten(); |
| 46 | |
| 47 | if let Some(path) = path { |
| 48 | self.gui.folder(&path); |
| 49 | self.scan_loop(path); |
| 50 | } |
| 51 | } |
| 52 | Ok(GuiRequest::Analyse) if self.info.is_some() => { |
| 53 | let path = self.info.take().unwrap().path; |
| 54 | self.gui.folder(&path); |
| 55 | self.scan_loop(path); |
| 56 | } |
| 57 | Ok(GuiRequest::Compress) if self.info.is_some() => { |
| 58 | self.compress_loop(); |
| 59 | } |
| 60 | Ok(GuiRequest::Decompress) if self.info.is_some() => { |
| 61 | self.uncompress_loop(); |
| 62 | } |
| 63 | Ok(msg) => { |
| 64 | eprintln!("Backend: Ignored message: {:?}", msg); |
| 65 | } |
| 66 | Err(_) => { |
| 67 | eprintln!("Backend: exit run loop"); |
| 68 | break; |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | fn scan_loop(&mut self, path: PathBuf) { |
| 75 | let excludes = config().read().unwrap().current().globset().expect("globs"); |
no test coverage detected