diff --git a/src/trees.jl b/src/trees.jl index 5c9e6ae..928d7dd 100644 --- a/src/trees.jl +++ b/src/trees.jl @@ -12,11 +12,19 @@ Base.size(p::Path) = size(p.entries) Base.IndexStyle(::Type{Path}) = IndexLinear() Base.convert(::Type{Path}, x::AbstractVector{<:AbstractString}) = Path(x) -Base.joinpath(p::Path, s...) = foldl(joinpath, s, init=p) +if VERSION < v"0.7-" + Base.joinpath(p::Path, s...) = foldl(joinpath, p, s) +else + Base.joinpath(p::Path, s...) = foldl(joinpath, s, init=p) +end Base.joinpath(p::Path, s::Symbol) = joinpath(p, String(s)) Base.joinpath(p::Path, s::AbstractString) = _joinpath(p, split(s, '/')) -_joinpath(p::Path, s::AbstractVector{<:AbstractString}) = foldl(_joinpath, s, init=p) +if VERSION < v"0.7-" + _joinpath(p::Path, s::AbstractVector{<:AbstractString}) = foldl(_joinpath, p, s) +else + _joinpath(p::Path, s::AbstractVector{<:AbstractString}) = foldl(_joinpath, s, init=p) +end _joinpath(p::Path, s::AbstractString) = isempty(s) ? Path(String[]) : Path(vcat(p.entries, s)) Base.show(io::IO, p::Path) = print(io, string('/', join(p.entries, '/')))