I have a package, BetaML, where I included in a subfolder “notebooks” some notebooks for documentation.
If in these notebooks I run abspath("BetaML")
, it expands to “/home/lobianco/.julia/dev/BetaML/notebooks/BetaML” (that it doesn’t exist) rather than “/home/lobianco/.julia/dev/BetaML”.
Why ?
What is your current directory when you run abspath
and in what way does the result not match the docstring for abspath
?
Ops. I completely misunderstood abspath, and for a while.
I was looking for a way to get the folder of an installed package by name and never realised that I was getting the “correct” result just because I was running… from the “right” place…
You probably want to use @__DIR__
as a starting point for locating a file within the same package. For outside packages there’s pathof
.
1 Like