# File lib/nanoc/base/result_data/item_rep.rb, line 121
      def write(snapshot=:last)
        # Get raw path
        raw_path = self.raw_path(:snapshot => snapshot)
        return if raw_path.nil?

        # Create parent directory
        FileUtils.mkdir_p(File.dirname(raw_path))

        # Check if file will be created
        is_created = !File.file?(raw_path)

        # Notify
        Nanoc::NotificationCenter.post(:will_write_rep, self, snapshot)

        if self.binary?
          temp_path = temporary_filenames[:last]
        else
          temp_path = self.temp_filename
          File.open(temp_path, 'w') { |io| io.write(@content[:last]) }
        end

        # Check whether content was modified
        is_modified = is_created || !FileUtils.identical?(raw_path, temp_path)

        # Write
        FileUtils.cp(temp_path, raw_path) if is_modified

        # Notify
        Nanoc::NotificationCenter.post(:rep_written, self, raw_path, is_created, is_modified)
      end