addDirectory method

  1. @override
Future<void> addDirectory(
  1. Directory dir, {
  2. bool includeDirName = true,
  3. int? level,
  4. bool followLinks = true,
})

Implementation

@override
Future<void> addDirectory(Directory dir,
    {bool includeDirName = true, int? level, bool followLinks = true}) async {
  // _encoder.signingBlock.write(_output);
  List files = dir.listSync(recursive: true, followLinks: followLinks);
  var futures = <Future<void>>[];
  for (var file in files) {
    if (file is! File) {
      continue;
    }

    final f = file;
    final dir_name = path.basename(dir.path);
    final rel_path = path.relative(f.path, from: dir.path);
    futures.add(addFile(
        f, includeDirName ? (dir_name + '/' + rel_path) : rel_path, level));
  }
  await Future.wait(futures);
}