join method

String join(
  1. String base,
  2. String relative
)

Joins relative onto base, rewriting each / of relative to this spelling's separator.

A relative that is absolute per this spelling is returned as is; an empty relative returns base.

Implementation

String join(String base, String relative) {
  if (relative.isEmpty) {
    return base;
  }
  if (isAbsolute(relative)) {
    return relative;
  }
  final String tail =
      _windows ? relative.replaceAll('/', separator) : relative;
  return base.endsWith(separator) ? '$base$tail' : '$base$separator$tail';
}