Not sure when pkgdir()
was first introduced, but as of Julia 1.7, I think a better method to address the OP’s original question is to call pkgdir(@__MODULE__)
inside the module
of the package being developed. This returns the root directory of the package.
You can further specify the relative path to the root directory as the second argument of pkgdir()
. For example, pkgdir(@__MODULE__, "src")
returns the src/
directory of the package.