isWithinOutputPath function Null safety

bool isWithinOutputPath(
  1. String outputDir,
  2. String filePath
)

Ensure filePath is contained in the outputDir folder, to make sure archives aren't trying to write to some system path.

Implementation

bool isWithinOutputPath(String outputDir, String filePath) {
  return p.isWithin(p.canonicalize(outputDir), p.canonicalize(filePath));
}