Skip to content

Commit 695842f

Browse files
complete documentation of LOAD_PATH
1 parent 6a4ccf3 commit 695842f

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

base/initdefs.jl

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,36 @@ const DEFAULT_LOAD_PATH = ["@", "@v#.#", "@stdlib"]
7676
LOAD_PATH
7777
7878
An array of paths for `using` and `import` statements to consider as project
79-
environments or package directories when loading code. See [Code Loading](@ref Code-Loading).
79+
environments or package directories when loading code. It is populated based on
80+
the [`JULIA_LOAD_PATH`](@ref JULIA_LOAD_PATH) environment variable if set;
81+
otherwise it defaults to `["@", "@v#.#", "@stdlib"]`. Entries starting with `@`
82+
have special meanings:
83+
84+
- `@` refers to the "current active environment", the initial value of which is
85+
initially determined by the [`JULIA_PROJECT`](@ref JULIA_PROJECT) environment
86+
variable or the `--project` command-line option.
87+
88+
- `@stdlib` expands to the absolute path of the current Julia installation's
89+
standard library directory.
90+
91+
- `@name` refers to a named environment, which are stored in depots (see
92+
[`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH)) under the `environments`
93+
subdirectory. The user's named environments are stored in
94+
`~/.julia/environments` so `@name` would refer to the environment in
95+
`~/.julia/environments/name` if it exists and contains a `Project.toml` file.
96+
If `name` contains `#` characters, then they are replaced with the major, minor
97+
and patch components of the Julia version number. For example, if you are
98+
running Julia 1.2 then `@v#.#` expands to `@v1.2` and will look for an
99+
environment by that name, typically at `~/.julia/environments/v1.2`.
100+
101+
The fully expanded value of `LOAD_PATH` that is searched for projects and packages
102+
can be seen by calling the `Base.load_path()` function.
103+
104+
See also:
105+
[`JULIA_LOAD_PATH`](@ref JULIA_LOAD_PATH),
106+
[`JULIA_PROJECT`](@ref JULIA_PROJECT),
107+
[`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH), and
108+
[Code Loading](@ref Code-Loading).
80109
"""
81110
const LOAD_PATH = copy(DEFAULT_LOAD_PATH)
82111
const HOME_PROJECT = Ref{Union{String,Nothing}}(nothing)

0 commit comments

Comments
 (0)