def write_to_csv(csv_file, dir, name, id):
    """
    Writes a row to the CSV file.

    :param csv_file: the file handle to write to.
    :type csv_file: file
    :param dir: the directory to write out
    :type dir: str`
    :param name: the file name (without path or extension)
    :type name: str
    :param id: the ID to write out
    :type id: str
    """
    csv_file.write('"')
    csv_file.write(dir)
    csv_file.write('"')
    csv_file.write(',')
    csv_file.write('"')
    csv_file.write(name.replace('"', ''))
    csv_file.write('"')
    csv_file.write(',')
    csv_file.write(id)
    csv_file.write('\n')
