File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -140,12 +140,20 @@ impl Watcher {
140140
141141 }
142142
143- fn handle_file < P : Into < PathBuf > > ( & self , path : P ) -> LLResult < String > {
144-
145- let epw = Epw :: from_file ( path) ?;
146- let res = & self . cse . get ( epw) ?;
147- res. save ( )
148-
143+ fn handle_file ( & self , path : & PathBuf ) -> LLResult < String > {
144+ let extension = path. extension ( ) . and_then ( |ext| { ext. to_str ( ) } ) ;
145+ match extension {
146+ Some ( s) => if s. eq_ignore_ascii_case ( "zip" ) {
147+ let epw = Epw :: from_file ( path) ?;
148+ let res = & self . cse . get ( epw) ?;
149+ res. save ( )
150+ } else {
151+ Err ( LLError :: new ( format ! ( "=> Ignoring non-zip: {}" , path. to_str( ) . unwrap( ) ) ) )
152+ }
153+ None => {
154+ Err ( LLError :: new ( format ! ( "=> Ignoring: {}" , path. to_str( ) . unwrap( ) ) ) )
155+ }
156+ }
149157 }
150158
151159}
You can’t perform that action at this time.
0 commit comments