uptodate static method

bool uptodate(
  1. String file, [
  2. List<String>? depends
])

Returns true if file is newer than all depends; otherwise false.

Implementation

static bool uptodate(String file, [List<String>? depends]) {
  if (file.isEmpty) {
    return false;
  }

  file = FilePath.expand(file);
  final stat = FileStat.statSync(file);
  if (stat.type == FileSystemEntityType.notFound) {
    return false;
  }

  if (depends == null) {
    return true;
  }

  final date = stat.modified;
  for (final name in depends) {
    final stat = FileStat.statSync(name);
    if (stat.type == FileSystemEntityType.notFound) {
      return false;
    }

    if (date.compareTo(stat.modified) < 0) {
      return false;
    }
  }

  return true;
}