File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -198,11 +198,11 @@ function pathsep(paths::AbstractString...)
198198end
199199
200200"""
201- splitpath(path::AbstractString) -> ( AbstractString, AbstractString, AbstractString...)
201+ splitpath(path::AbstractString) -> [ AbstractString, AbstractString, AbstractString...]
202202
203203Split a file path into all its path components. This is the opposite of
204- `joinpath`. Returns a tuple of strings , one for each directory or file in the
205- path, including the root directory if present.
204+ `joinpath`. Returns an array of substrings , one for each directory or file in
205+ the path, including the root directory if present.
206206
207207# Examples
208208```jldoctest
@@ -211,13 +211,15 @@ julia> splitpath("/home/myuser/example.jl")
211211```
212212"""
213213function splitpath (p:: AbstractString )
214- out = ()
214+ out = AbstractString[]
215215 while true
216- isempty (p) && return out
217- ismount (p) && return ( dirname (p), out ... )
216+ isempty (p) && break
217+ ismount (p) && ( push! (out, dirname (p)); break )
218218 isempty (basename (p)) && (p = dirname (p); continue ) # Trailing '/'.
219- (p, out) = dirname (p), (basename (p), out... )
219+ push! (out, basename (p))
220+ p = dirname (p)
220221 end
222+ return reverse (out)
221223end
222224
223225joinpath (a:: AbstractString ) = a
You can’t perform that action at this time.
0 commit comments