joinPaths function
Joins a list of paths into a single normalized path string.
The first element in paths
is joined as-is, while subsequent elements
are normalized using pathNorm to ensure consistency.
Example usage:
String fullPath = joinPaths(['assets', 'images', 'logo.png']);
Implementation
String joinPaths(List<String> paths) {
var pathsNorm = <String>[];
var isNotFirst = false;
for (var element in paths) {
if (isNotFirst) {
element = pathNorm(element);
} else {
isNotFirst = true;
}
pathsNorm.add(element);
}
return p.joinAll(pathsNorm);
}