From dbf9c4fc97588f229c7db9861275f5dbec3db114 Mon Sep 17 00:00:00 2001 From: Cody Tapscott Date: Sun, 5 May 2024 12:46:26 -0400 Subject: [PATCH 1/2] fix handling of `nothing` in init_load_path Co-authored-by: Jeff Bezanson --- base/initdefs.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/base/initdefs.jl b/base/initdefs.jl index 182984ae01d56..d019f4d5ba74a 100644 --- a/base/initdefs.jl +++ b/base/initdefs.jl @@ -245,8 +245,11 @@ function init_load_path() if haskey(ENV, "JULIA_LOAD_PATH") paths = parse_load_path(ENV["JULIA_LOAD_PATH"]) else - paths = filter!(env -> env !== nothing, - String[env == "@." ? current_project() : env for env in DEFAULT_LOAD_PATH]) + paths = String[ + env == "@." ? current_project() : env + for env in DEFAULT_LOAD_PATH + if env !== nothing + ] end append!(empty!(LOAD_PATH), paths) end From b430454781e75c46a11dffcd7c66c9cf729080cf Mon Sep 17 00:00:00 2001 From: Cody Tapscott <84105208+topolarity@users.noreply.github.com> Date: Tue, 7 May 2024 07:40:07 -0400 Subject: [PATCH 2/2] Fix `env` check Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> --- base/initdefs.jl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/base/initdefs.jl b/base/initdefs.jl index d019f4d5ba74a..60fbaded1b282 100644 --- a/base/initdefs.jl +++ b/base/initdefs.jl @@ -245,11 +245,14 @@ function init_load_path() if haskey(ENV, "JULIA_LOAD_PATH") paths = parse_load_path(ENV["JULIA_LOAD_PATH"]) else - paths = String[ - env == "@." ? current_project() : env - for env in DEFAULT_LOAD_PATH - if env !== nothing - ] + paths = String[] + for env in DEFAULT_LOAD_PATH + if env == "@." + env = current_project() + env === nothing && continue + end + push!(paths, env) + end end append!(empty!(LOAD_PATH), paths) end