cleaner: reorganize clean_dir to avoid repeated conditional
This commit is contained in:
		
							parent
							
								
									676f29d757
								
							
						
					
					
						commit
						095d83d10b
					
				@ -74,21 +74,17 @@ class Cleaner
 | 
			
		||||
    d.find do |path|
 | 
			
		||||
      path.extend(NoisyPathname) if ARGV.verbose?
 | 
			
		||||
 | 
			
		||||
      if path.directory?
 | 
			
		||||
        # Stop cleaning this subtree if protected
 | 
			
		||||
        Find.prune if @f.skip_clean? path
 | 
			
		||||
      elsif not path.file?
 | 
			
		||||
        # Sanity?
 | 
			
		||||
      Find.prune if @f.skip_clean? path
 | 
			
		||||
 | 
			
		||||
      if path.symlink? or path.directory?
 | 
			
		||||
        next
 | 
			
		||||
      elsif path.extname == '.la'
 | 
			
		||||
        # *.la files are stupid
 | 
			
		||||
        path.unlink unless @f.skip_clean? path
 | 
			
		||||
        path.unlink
 | 
			
		||||
      elsif path == @f.lib+'charset.alias'
 | 
			
		||||
        # Many formulae symlink this file, but it is not strictly needed
 | 
			
		||||
        path.unlink unless @f.skip_clean? path
 | 
			
		||||
      elsif not path.symlink?
 | 
			
		||||
        # Fix permissions
 | 
			
		||||
        clean_file_permissions(path) unless @f.skip_clean? path
 | 
			
		||||
        path.unlink
 | 
			
		||||
      else
 | 
			
		||||
        clean_file_permissions(path)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user