sanitizedChildFile method

File sanitizedChildFile(
  1. String basename
)

Implementation

File sanitizedChildFile(String basename) {
  final segments = p.absolute(path, p.normalize(basename)).split(p.separator)
    ..removeWhere((element) => element == '..');

  final relative =
      p.relative('${p.separator}${p.joinAll(segments)}', from: path);

  return childFile(relative);
}