normalizePath static method

String normalizePath(
  1. String path
)

Implementation

static String normalizePath(String path) {
  path = path.trim();

  var path2 = normalizePlatformPath(path, asPosix: true);
  var parts = splitPathRootPrefix(path2, asPosix: true);

  var path3 = parts[1];

  if (startsWithDriver(path3)) {
    throw StateError("Can't normalize path: $path -> $path3");
  }

  while (startsWithGenericPathSeparator(path3)) {
    path3 = path3.substring(1);
  }

  if (path3.isEmpty) {
    throw StateError("Can't normalize path: $path");
  }

  return path3;
}