File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,10 @@ impl Lock {
9999        self . file . unlock ( ) . unwrap_or_default ( ) ; 
100100        fs:: remove_file ( & self . path ) . unwrap_or_default ( ) ; 
101101    } 
102+ 
103+     fn  exists ( & mut  self )  -> bool  { 
104+         self . path . exists ( ) 
105+     } 
102106} 
103107
104108pub  fn  create_parent_path_if_not_exists ( path :  & Path )  -> Result < ( ) ,  Error >  { 
@@ -154,6 +158,19 @@ pub fn uncompress(
154158
155159    // Acquire file lock to prevent race conditions accessing the cache folder by concurrent SM processes 
156160    let  mut  lock = Lock :: acquire ( log,  target,  single_file. clone ( ) ) ?; 
161+     if  !lock. exists ( )  { 
162+         let  num_files_in_target = WalkDir :: new ( target) . into_iter ( ) . count ( ) ; 
163+         if  ( single_file. is_some ( )  && num_files_in_target == 1 ) 
164+             || ( single_file. is_none ( )  && num_files_in_target > 1 ) 
165+         { 
166+             log. trace ( format ! ( 
167+                 "{} file(s) in {}" , 
168+                 num_files_in_target, 
169+                 target. display( ) 
170+             ) ) ; 
171+             return  Ok ( ( ) ) ; 
172+         } 
173+     } 
157174
158175    if  extension. eq_ignore_ascii_case ( ZIP )  { 
159176        unzip ( compressed_file,  target,  log,  single_file) ?
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments