Steven J has given a partial solution to this here 
<https://github.com/JuliaLang/julia/issues/8679#issuecomment-75764753>: if 
a package wants to know where it is, it should probably use 
dirpath(@__FILE__) to get the location of the file that's doing the work. 
Pkg.dir() still probably needs to be smarter overall, but this at least 
lets me fix the issue with Nettle.

Scott

On Tuesday, 24 February 2015 13:44:45 UTC, Scott T wrote:
>
> Hi all,
>
> I've been playing around with trying to install Julia and some basic 
> packages system-wide to run a workshop for our department in a couple of 
> weeks time. Mostly it's working well, and I'm really excited about seeing 
> what people think!
>
> I ran into the problem that Pkg.dir("PackageName"), although documented as 
> returning the path to a package, doesn't necessarily do this in the right 
> way. In particular, if a user has set up their own .julia directory, doing 
> Pkg.dir("ASharedPackage") returns ~/.julia/v0.x/ASharedPackage even if that 
> folder doesn't exist. 
>
> That is, if JULIA_PKGDIR is not the same as the directory the package is 
> *actually* in, Pkg.dir("Package") won't give the right location.
>
> I hit this problem trying to get IJulia installed for everyone to use, 
> becase one of its dependencies Nettle uses Pkg.dir("Nettle") to find itself 
> when loaded, and so if installed system-wide (in <julia>/local/share) it 
> won't work.
>
> So, is there a more reliable way to get the path to a package? 
>
> [Pkg.dir might need to be smarter instead, but that's more a development 
> question. I commented on that here 
> <https://github.com/JuliaLang/julia/issues/8679>]
>
> Cheers,
> Scott
>

Reply via email to