Skip to content

Commit 6f039ff

Browse files
lookup path using moduleroot & pathof
1 parent 6c9bc01 commit 6f039ff

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

base/loading.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,13 +1268,14 @@ function _include_from_serialized(pkg::PkgId, path::String, ocachepath::Union{No
12681268
end
12691269

12701270
function extension_parent(M::Module)
1271-
@show _pkgdir = pkgdir(M)
1272-
_pkgdir === nothing && return nothing
1273-
pkgdir_parts = splitpath(_pkgdir)
1271+
rootmodule = moduleroot(M)
1272+
src_path = pathof(rootmodule)
1273+
src_path === nothing && return nothing
1274+
pkgdir_parts = splitpath(src_path)
12741275
ext_pos = findlast(==("ext"), pkgdir_parts)
1275-
if ext_pos !== nothing && ext_pos >= length(pkgdir_parts) - 1
1276-
@show parent_package_root = joinpath(pkgdir_parts[1:ext_pos-1]...)
1277-
@show parent_package_project_file = locate_project_file(parent_package_root)
1276+
if ext_pos !== nothing && ext_pos >= length(pkgdir_parts) - 2
1277+
parent_package_root = joinpath(pkgdir_parts[1:ext_pos-1]...)
1278+
parent_package_project_file = locate_project_file(parent_package_root)
12781279
if parent_package_project_file isa String
12791280
d = parsed_toml(parent_package_project_file)
12801281
name = get(d, "name", nothing)

0 commit comments

Comments
 (0)