diff --git a/base/loading.jl b/base/loading.jl index 48a5b6a8ab71f..922869a3b4495 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -519,7 +519,11 @@ end function source_dir() isinteractive() && return pwd() p = source_path(nothing) - p === nothing ? p : dirname(p) + if p === nothing + isinteractive() ? pwd() : p + else + dirname(p) + end end """