deepSearch function

Future<void> deepSearch(
  1. RemoteLab root,
  2. String path,
  3. String host
)

Implementation

Future<void> deepSearch(RemoteLab root, String path, String host) async {
  if (root is RemoteSub) {
    var dir = Directory('$path${Platform.pathSeparator}${root.name}');
    if (!dir.existsSync()) dir.createSync();
    await Future.forEach<RemoteLab>(root.sub, (node) async {
      await deepSearch(node, dir.path, host);
    });
  } else if (root is RemoteLib) {
    var dir = Directory('$path${Platform.pathSeparator}${root.name}');
    if (!dir.existsSync()) dir.createSync();
    Future.forEach<LibBranch>(
        root.library,
        (lib) =>
            pull(lib, '${dir.path}${Platform.pathSeparator}${lib.name}', host));
  }
}