# File lib/fsdb/database.rb, line 451
  def delete(path)                  # :yields: object
    abs_path = absolute(path)
    file_id = get_file_id(abs_path)
    object_exclusive file_id do |cache_entry|
      open_write_lock(abs_path) do |f|
        object = cache_object(f, cache_entry)
        result = block_given? ? (yield object) : object
        File.delete(abs_path) rescue Dir.delete(abs_path)
        cache_entry.stale!
        del_version_of(f)
        result
      end
    end
  rescue MissingFileError
    nil
  rescue AbortedTransaction
  ensure
    clear_entry(file_id)
  end