# File lib/file_systems/AppleDos.rb, line 349
  def self.delete_file(file_system_image,filename)
    this_files_catalog_slot=find_catalog_slot(file_system_image,filename)    
    #if file not in catalog, do nothing
    return if this_files_catalog_slot.nil? 
    file_descriptive_entry=file_system_image.get_sector(this_files_catalog_slot[0],this_files_catalog_slot[1])[this_files_catalog_slot[2],0x23]
    
    #mark sector as free in sector usage list
    sector_usage_bitmap_sector=file_system_image.get_sector(vtoc_track_no,vtoc_sector_no)
    sectors_to_mark_available=get_track_sector_list(file_system_image,file_descriptive_entry[0x00],file_descriptive_entry[0x01])
    sectors_to_mark_available<<[file_descriptive_entry[0x01],file_descriptive_entry[0x00]]
    
    sectors_to_mark_available.each do |ts|
      offset_of_byte_containing_this_sector=0x38+(ts[0]*4)
      if ts[1]<8 then 
        offset_of_byte_containing_this_sector+=1
      end
      byte_containing_this_sector=sector_usage_bitmap_sector[offset_of_byte_containing_this_sector]   
      byte_containing_this_sector=byte_containing_this_sector|(2**(ts[1]%8))
      sector_usage_bitmap_sector[offset_of_byte_containing_this_sector]=byte_containing_this_sector
    end
    file_system_image.set_sector(vtoc_track_no,vtoc_sector_no,sector_usage_bitmap_sector)
    
    #mark slot as available in catalog
    catalog_sector=file_system_image.get_sector(this_files_catalog_slot[0],this_files_catalog_slot[1])
    catalog_sector[this_files_catalog_slot[2]+0x20]=catalog_sector[this_files_catalog_slot[2]] #save the current "first track no" in last byte of filename
    catalog_sector[this_files_catalog_slot[2]]=0xFF
    file_system_image.set_sector(this_files_catalog_slot[0],this_files_catalog_slot[1],catalog_sector)
  end