Skip to content

Commit

Permalink
Document include path separator normalization via normpath (JuliaLang…
Browse files Browse the repository at this point in the history
  • Loading branch information
mkitti authored and LilithHafner committed Mar 8, 2022
1 parent 21b9361 commit dcd60f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,8 @@ Returns the result of the last evaluated expression of the input file. During in
a task-local include path is set to the directory containing the file. Nested calls to
`include` will search relative to that path. This function is typically used to load source
interactively, or to combine files in packages that are broken into multiple source files.
The argument `path` is normalized using [`normpath`](@ref) which will resolve
relative path tokens such as `..` and convert `/` to the appropriate path separator.
The optional first argument `mapexpr` can be used to transform the included code before
it is evaluated: for each parsed expression `expr` in `path`, the `include` function
Expand Down
6 changes: 5 additions & 1 deletion base/path.jl
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,16 @@ joinpath
"""
normpath(path::AbstractString) -> String
Normalize a path, removing "." and ".." entries.
Normalize a path, removing "." and ".." entries and changing "/" to the canonical path separator
for the system.
# Examples
```jldoctest
julia> normpath("/home/myuser/../example.jl")
"/home/example.jl"
julia> normpath("Documents/Julia") == joinpath("Documents", "Julia")
true
```
"""
function normpath(path::String)
Expand Down

0 comments on commit dcd60f1

Please sign in to comment.