Skip to content

Commit 9a2e763

Browse files
authored
Document include path separator normalization via normpath (#42429)
1 parent a8d42eb commit 9a2e763

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

base/client.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,8 @@ Returns the result of the last evaluated expression of the input file. During in
472472
a task-local include path is set to the directory containing the file. Nested calls to
473473
`include` will search relative to that path. This function is typically used to load source
474474
interactively, or to combine files in packages that are broken into multiple source files.
475+
The argument `path` is normalized using [`normpath`](@ref) which will resolve
476+
relative path tokens such as `..` and convert `/` to the appropriate path separator.
475477
476478
The optional first argument `mapexpr` can be used to transform the included code before
477479
it is evaluated: for each parsed expression `expr` in `path`, the `include` function

base/path.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,12 +356,16 @@ joinpath
356356
"""
357357
normpath(path::AbstractString) -> String
358358
359-
Normalize a path, removing "." and ".." entries.
359+
Normalize a path, removing "." and ".." entries and changing "/" to the canonical path separator
360+
for the system.
360361
361362
# Examples
362363
```jldoctest
363364
julia> normpath("/home/myuser/../example.jl")
364365
"/home/example.jl"
366+
367+
julia> normpath("Documents/Julia") == joinpath("Documents", "Julia")
368+
true
365369
```
366370
"""
367371
function normpath(path::String)

0 commit comments

Comments
 (0)