PathUri.parse constructor
PathUri.parse(
- String path
Creates a new PathUri
object by parsing a path
string.
An empty path
is considered to be the current working directory.
Implementation
factory PathUri.parse(String path) {
final parts = path.split('/');
if (parts.length == 1 && parts.single.isEmpty) {
return PathUri(
isAbsolute: false,
isDirectory: true,
pathSegments: BuiltList(),
);
}
return PathUri(
isAbsolute: parts.first.isEmpty,
isDirectory: parts.last.isEmpty,
pathSegments: BuiltList(parts.where((element) => element.isNotEmpty)),
);
}