Skip to content

Commit

Permalink
Docstring for one more normpath method. (JuliaLang#33700)
Browse files Browse the repository at this point in the history
* Docstring for one more normpath method.

* normpath and abspath always return String.
  • Loading branch information
GunnarFarneback authored and StefanKarpinski committed Dec 2, 2019
1 parent 25ac16b commit 656f412
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions base/path.jl
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ julia> joinpath("/home/myuser", "example.jl")
joinpath

"""
normpath(path::AbstractString) -> AbstractString
normpath(path::AbstractString) -> String
Normalize a path, removing "." and ".." entries.
Expand Down Expand Up @@ -362,18 +362,25 @@ function normpath(path::String)
end
string(drive,path)
end

"""
normpath(path::AbstractString, paths::AbstractString...) -> String
Convert a set of paths to a normalized path by joining them together and removing
"." and ".." entries. Equivalent to `normpath(joinpath(path, paths...))`.
"""
normpath(a::AbstractString, b::AbstractString...) = normpath(joinpath(a,b...))

"""
abspath(path::AbstractString) -> AbstractString
abspath(path::AbstractString) -> String
Convert a path to an absolute path by adding the current directory if necessary.
Also normalizes the path as in [`normpath`](@ref).
"""
abspath(a::String) = normpath(isabspath(a) ? a : joinpath(pwd(),a))

"""
abspath(path::AbstractString, paths::AbstractString...) -> AbstractString
abspath(path::AbstractString, paths::AbstractString...) -> String
Convert a set of paths to an absolute path by joining them together and adding the
current directory if necessary. Equivalent to `abspath(joinpath(path, paths...))`.
Expand Down

0 comments on commit 656f412

Please sign in to comment.