cleanUpFiles method
Implementation
Future<void> cleanUpFiles(Directory directory) async {
final trackedFilePaths = filePaths.toSet();
await fileHelper.visit(directory, (entity, depth) async {
if (depth != 0) {
return false;
}
final relativePath = relative(entity.path, from: directory.path);
if (trackedFilePaths.contains(relativePath) ||
relativePath == kRemoteHooksConfig) {
if (await entity.exists()) {
await entity.delete(recursive: true);
}
}
return true;
});
}