Example #1
0
PathName PathName::join(cstring component) const {
    if (component.isNullOrEmpty())
        throw std::logic_error("Empty string for pathname component");
    if (str.isNullOrEmpty())
        return PathName(component);
    char last = str[str.size() - 1];
    for (char c : pathSeparators) {
        if (c == last) {
            auto result = str + component;
            return PathName(result);
        }
    }
    auto result = str + separator() + component;
    return PathName(result);
}