From 28624a416b60c80a7bf59107f55e93ee2590b5bf Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Thu, 23 Aug 2018 16:59:38 -0400 Subject: [PATCH] foldl --- src/trees.jl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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, '/')))