Skip to content

Commit

Permalink
Handle custom manifest name (#3000)
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth authored Feb 22, 2022
1 parent 2b78a74 commit 3aa1505
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,24 @@ function projectfile_path(env_path::String; strict=false)
end

function manifestfile_path(env_path::String; strict=false)
for name in Base.manifest_names
man_names = @static Base.manifest_names isa Tuple ? Base.manifest_names : Base.manifest_names()
for name in man_names
maybe_file = joinpath(env_path, name)
isfile(maybe_file) && return maybe_file
end
if strict
return nothing
else
project = basename(projectfile_path(env_path)::String)
idx = findfirst(x -> x == project, Base.project_names)
@assert idx !== nothing
return joinpath(env_path, Base.manifest_names[idx])
n_names = length(man_names)
if n_names == 1
return joinpath(env_path, only(man_name))
else
project = basename(projectfile_path(env_path)::String)
idx = findfirst(x -> x == project, Base.project_names)
@assert idx !== nothing
idx = idx + (n_names - length(Base.project_names)) # ignore custom name if present
return joinpath(env_path, man_names[idx])
end
end
end

Expand Down

0 comments on commit 3aa1505

Please sign in to comment.