validate method

  1. @override
Future<void> validate([
  1. String? parent
])
override

Validates that the physical file system under parent (which defaults to sandbox) contains an entry that matches this descriptor.

Implementation

@override
Future<void> validate([String? parent]) async {
  var fullPath = p.join(parent ?? sandbox, name);
  var pretty = prettyPath(fullPath);
  if (File(fullPath).existsSync()) {
    fail('Expected nothing to exist at "$pretty", but found a file.');
  } else if (Directory(fullPath).existsSync()) {
    fail('Expected nothing to exist at "$pretty", but found a directory.');
  } else if (Link(fullPath).existsSync()) {
    fail('Expected nothing to exist at "$pretty", but found a link.');
  }
}