joinPaths static method
Joins parts to a combined path.
first
: first part
second
: second part
third
: third part
deprecated: Use join() from package path
Implementation
@deprecated
static String joinPaths(String first, String second, [String? third]) {
final rc = StringBuffer(first);
var last = first;
if (second.isNotEmpty) {
if (!first.endsWith(sep)) {
rc.write(sep);
}
if (second.startsWith(currentDirSep)) {
rc.write(second.substring(2));
} else if (second.startsWith(sep)) {
rc.write(second.substring(1));
} else {
rc.write(second);
}
last = second;
}
if (third != null && third.isNotEmpty) {
if (!last.endsWith(sep)) {
rc.write(sep);
}
if (third.startsWith(currentDirSep)) {
rc.write(third.substring(2));
} else if (third.startsWith(sep)) {
rc.write(third.substring(1));
} else {
rc.write(third);
}
}
return rc.toString();
}