addFile method

void addFile(
  1. ArchiveFile file
)

Add a file to the archive.

Implementation

void addFile(ArchiveFile file) {
  // Adding a file with the same path as one that's already in the archive
  // will replace the previous file.
  var index = _fileMap[file.name];
  if (index != null) {
    _files[index] = file;
    return;
  }
  // No existing file was in the archive with the same path, add it to the
  // archive.
  _files.add(file);
  _fileMap[file.name] = _files.length - 1;
}