normalizeOutput static method
Normalizes an output path (./build/out -> build/out).
Throws an ArgumentError if it's absolute or outside the root directory: the bundle couldn't be mapped into the release.
Implementation
static String normalizeOutput(String output) {
var normalized = pack_path.posix.normalize(output.replaceAll(r'\', '/'));
if (pack_path.posix.isAbsolute(normalized) ||
pack_path.windows.isAbsolute(output) ||
normalized == '.' ||
normalized == '..' ||
normalized.startsWith('../')) {
throw ArgumentError(
"`dart_build_cli` output must be a directory inside the root "
"directory: $output",
);
}
return normalized;
}