Skip to content

Commit 8a0de1d

Browse files
fix lib dir handling
Co-Authored-By: Jameson Nash <[email protected]>
1 parent ec8aa60 commit 8a0de1d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

stdlib/Profile/src/Profile.jl

+8-7
Original file line numberDiff line numberDiff line change
@@ -504,20 +504,21 @@ function flatten(data::Vector, lidict::LineInfoDict)
504504
end
505505

506506
const SRC_DIR = normpath(joinpath(Sys.BUILD_ROOT_PATH, "src"))
507-
const LIB_DIR = normpath(joinpath(Sys.BUILD_ROOT_PATH, "usr", "lib"))
508507

509508
# Take a file-system path and try to form a concise representation of it
510509
# based on the package ecosystem
511510
function short_path(spath::Symbol, filenamecache::Dict{Symbol, Tuple{String,String,String}})
512511
return get!(filenamecache, spath) do
513512
path = Base.fixup_stdlib_path(string(spath))
513+
path_norm = normpath(path)
514514
possible_base_path = normpath(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "base", path))
515-
if startswith(path, SRC_DIR)
516-
remainder = only(split(path, SRC_DIR, keepempty=false))
517-
return (isfile(path) ? path : ""), "@src", remainder
518-
elseif startswith(path, LIB_DIR)
519-
remainder = only(split(path, LIB_DIR, keepempty=false))
520-
return (isfile(path) ? path : ""), "@lib", remainder
515+
lib_dir = abspath(Sys.BINDIR, Base.LIBDIR)
516+
if startswith(path_norm, SRC_DIR)
517+
remainder = only(split(path_norm, SRC_DIR, keepempty=false))
518+
return (isfile(path_norm) ? path_norm : ""), "@juliasrc", remainder
519+
elseif startswith(path_norm, lib_dir)
520+
remainder = only(split(path_norm, lib_dir, keepempty=false))
521+
return (isfile(path_norm) ? path_norm : ""), "@julialib", remainder
521522
elseif isabspath(path)
522523
if ispath(path)
523524
# try to replace the file-system prefix with a short "@Module" one,

0 commit comments

Comments
 (0)