resolvePath method

String resolvePath(
  1. String path, {
  2. String? fromDirectory,
})

Resolves path against fromDirectory (or the current working directory) and normalizes away . and .. segments.

Implementation

String resolvePath(String path, {String? fromDirectory}) {
  final trimmed = path.trim();
  final base = fromDirectory ?? currentWorkingDirectory;
  if (trimmed.isEmpty) {
    return _normalize(base);
  }
  return _normalize(p.isAbsolute(trimmed) ? trimmed : p.join(base, trimmed));
}