displayPath function

String displayPath(
  1. String path
)

path relative to the current directory when that is shorter and does not climb more than one level.

Implementation

String displayPath(String path) {
  final relative = p.relative(path);
  return relative.length < path.length && !relative.startsWith('../..')
      ? relative
      : path;
}