@@ -115,12 +115,11 @@ impl System for OsSystem {
115115 path. as_std_path ( ) . exists ( )
116116 }
117117
118- fn path_exists_case_sensitive ( & self , path : & SystemPath , prefix : & SystemPath ) -> Result < bool > {
118+ fn path_exists_case_sensitive ( & self , path : & SystemPath , prefix : & SystemPath ) -> bool {
119119 if self . case_sensitivity ( ) . is_case_sensitive ( ) {
120- Ok ( self . path_exists ( path) )
120+ self . path_exists ( path)
121121 } else {
122122 self . path_exists_case_sensitive_fast ( path)
123- . map ( Ok )
124123 . unwrap_or_else ( || self . path_exists_case_sensitive_slow ( path, prefix) )
125124 }
126125 }
@@ -276,23 +275,30 @@ impl OsSystem {
276275 Some ( simplified_canonicalized == simplified)
277276 }
278277
279- fn path_exists_case_sensitive_slow (
280- & self ,
281- path : & SystemPath ,
282- prefix : & SystemPath ,
283- ) -> Result < bool > {
278+ fn path_exists_case_sensitive_slow ( & self , path : & SystemPath , prefix : & SystemPath ) -> bool {
284279 // Iterate over the sub-paths up to prefix and check if they match the casing as on disk.
285280 for ancestor in path. ancestors ( ) {
286281 if ancestor == prefix {
287282 break ;
288283 }
289284
290- if !self . inner . real_case_cache . has_name_case ( ancestor) ? {
291- return Ok ( false ) ;
285+ match self . inner . real_case_cache . has_name_case ( ancestor) {
286+ Ok ( true ) => {
287+ // Component has correct casing, continue with next component
288+ }
289+ Ok ( false ) => {
290+ // Component has incorrect casing
291+ return false ;
292+ }
293+ Err ( _) => {
294+ // Directory doesn't exist or can't be accessed. We can assume that the file with
295+ // the given casing doesn't exist.
296+ return false ;
297+ }
292298 }
293299 }
294300
295- Ok ( true )
301+ true
296302 }
297303}
298304
0 commit comments