Skip to content

Commit

Permalink
lookup path using moduleroot & pathof
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Sep 9, 2024
1 parent 6c9bc01 commit 6f039ff
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1268,13 +1268,14 @@ function _include_from_serialized(pkg::PkgId, path::String, ocachepath::Union{No
end

function extension_parent(M::Module)
@show _pkgdir = pkgdir(M)
_pkgdir === nothing && return nothing
pkgdir_parts = splitpath(_pkgdir)
rootmodule = moduleroot(M)
src_path = pathof(rootmodule)
src_path === nothing && return nothing
pkgdir_parts = splitpath(src_path)
ext_pos = findlast(==("ext"), pkgdir_parts)
if ext_pos !== nothing && ext_pos >= length(pkgdir_parts) - 1
@show parent_package_root = joinpath(pkgdir_parts[1:ext_pos-1]...)
@show parent_package_project_file = locate_project_file(parent_package_root)
if ext_pos !== nothing && ext_pos >= length(pkgdir_parts) - 2
parent_package_root = joinpath(pkgdir_parts[1:ext_pos-1]...)
parent_package_project_file = locate_project_file(parent_package_root)
if parent_package_project_file isa String
d = parsed_toml(parent_package_project_file)
name = get(d, "name", nothing)
Expand Down

0 comments on commit 6f039ff

Please sign in to comment.