file method
The file at path -- relative, with /, as dvAssetPath returns it --
or null when there is none. A directory is not a file.
Implementation
@override
DVAssetFile? file(String path) {
// Callers pass what dvAssetPath returns; refused here as well, because a
// directory is the one source a dot-dot could actually leave.
if (path.split('/').any((String s) => s == '..' || s.isEmpty) || path.contains(r'\')) {
return null;
}
final File file = File(<String>[root, ...path.split('/')].join(Platform.pathSeparator));
final FileStat stat = file.statSync();
if (stat.type != FileSystemEntityType.file) return null;
return _DirectoryFile(path, file, stat);
}