# abspath("PackageName") in a subfolder expands to the wrong path

**URL:** <https://discourse.julialang.org/t/abspath-packagename-in-a-subfolder-expands-to-the-wrong-path/51447>\
**Category:** General Usage\
**Created:** [December 8, 2020, 9:31am UTC](https://discourse.julialang.org/t/abspath-packagename-in-a-subfolder-expands-to-the-wrong-path/51447 "2020-12-08T09:31:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [December 8, 2020, 9:31am UTC](https://discourse.julialang.org/t/abspath-packagename-in-a-subfolder-expands-to-the-wrong-path/51447/1 "2020-12-08T09:31:33Z")

</div>

I have a package, [BetaML](https://github.com/sylvaticus/BetaML.jl), 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 ?

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [December 8, 2020, 10:08am UTC](https://discourse.julialang.org/t/abspath-packagename-in-a-subfolder-expands-to-the-wrong-path/51447/2 "2020-12-08T10:08:46Z")

</div>

What is your current directory when you run `abspath` and in what way does the result not match the docstring for `abspath`?

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [December 8, 2020, 10:15am UTC](https://discourse.julialang.org/t/abspath-packagename-in-a-subfolder-expands-to-the-wrong-path/51447/3 "2020-12-08T10:15:57Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [December 8, 2020, 10:21am UTC](https://discourse.julialang.org/t/abspath-packagename-in-a-subfolder-expands-to-the-wrong-path/51447/4 "2020-12-08T10:21:35Z")

</div>

You probably want to use `@ __DIR__ ` as a starting point for locating a file within the same package. For outside packages there’s `pathof`.
