Skip to content

Commit

Permalink
REPL: fix projname when project_file is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Jun 14, 2024
1 parent 2b90174 commit a550bb8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions stdlib/REPL/src/Pkg_beforeload.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,14 @@ function relative_project_path(project_file::String, path::String)
end

function projname(project_file::String)
p = Base.TOML.Parser()
Base.TOML.reinit!(p, read(project_file, String); filepath=project_file)
proj = Base.TOML.parse(p)
name = get(proj, "name", nothing)
if isfile(project_file)
p = Base.TOML.Parser()
Base.TOML.reinit!(p, read(project_file, String); filepath=project_file)
proj = Base.TOML.parse(p)
name = get(proj, "name", nothing)
else
name = nothing
end
if name === nothing
name = basename(dirname(project_file))
end
Expand Down

0 comments on commit a550bb8

Please sign in to comment.