prune static method

Future<List<String>> prune(
  1. String projectRoot,
  2. Set<ProfileId> keep
)

Deletes every marked directory whose id is not in keep, because its Profile no longer ships a skill or is no longer locked, and returns them. Also deletes the marked staged or replaced copies an interrupted write left behind.

Implementation

static Future<List<String>> prune(
  String projectRoot,
  Set<ProfileId> keep,
) async {
  final removed = <String>[];
  for (final (:entry, :reported) in await _prunable(projectRoot, keep)) {
    await entry.delete(recursive: true);
    if (reported case final path?) removed.add(path);
  }
  return removed;
}