Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ New library features
* `sort(keys(::Dict))` and `sort(values(::Dict))` now automatically collect, they previously threw ([#56978]).
* `Base.AbstractOneTo` is added as a supertype of one-based axes, with `Base.OneTo` as its subtype ([#56902]).
* `takestring!(::IOBuffer)` removes the content from the buffer, returning the content as a `String`.
* New `Base.active_manifest()` function to return the path of the active manifest, like `Base.active_project()`.
Also can return the manifest that would be used for a given project file ([#57937]).

Standard library changes
------------------------
Expand Down
15 changes: 15 additions & 0 deletions base/initdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,21 @@ function set_active_project(projfile::Union{AbstractString,Nothing})
end
end

"""
active_manifest()
active_manifest(project_file::AbstractString)

Return the path of the active manifest file, or the manifest file that would be used for a given `project_file`.
See [`Project environments`](@ref) for details on the difference between a project and a manifest, and the naming
options and their priority in package loading.

See also [`Base.active_project`](@ref), [`Base.set_active_project`](@ref).
"""
function active_manifest(project_file::Union{AbstractString,Nothing}=nothing, search_load_path::Bool=true)
project_file = something(project_file, active_project(search_load_path))
project_file === nothing && return nothing
return project_file_manifest_path(project_file)
end

"""
load_path()
Expand Down
1 change: 1 addition & 0 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ function project_file_manifest_path(project_file::String)::Union{Nothing,String}
manifest_path === missing || return manifest_path
end
dir = abspath(dirname(project_file))
isfile_casesensitive(project_file) || return nothing
d = parsed_toml(project_file)
base_manifest = workspace_manifest(project_file)
if base_manifest !== nothing
Expand Down
1 change: 1 addition & 0 deletions base/public.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public
DL_LOAD_PATH,
load_path,
active_project,
active_manifest,

# Reflection and introspection
get_extension,
Expand Down
1 change: 1 addition & 0 deletions doc/src/base/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ans
err
Base.active_project
Base.set_active_project
Base.active_manifest
```

## [Keywords](@id Keywords)
Expand Down