# \_\_FILE\_\_ path when "--static" build

**URL:** <https://forum.crystal-lang.org/t/file-path-when-static-build/2432>\
**Category:** Help & Support\
**Created:** [August 10, 2020, 5:04pm UTC](https://forum.crystal-lang.org/t/file-path-when-static-build/2432 "2020-08-10T17:04:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![takanotume24](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/takanotume24/32/682_2.png) [@takanotume24](https://forum.crystal-lang.org/u/takanotume24)\
**Post date:** [August 10, 2020, 5:04pm UTC](https://forum.crystal-lang.org/t/file-path-when-static-build/2432/1 "2020-08-10T17:04:07Z")

</div>

Hello.

Is ` __FILE__ ` and ` __DIR__ ` a compile-time path for a `--static` build?  
Is there a way to get the runtime path from ` __DIR__ ` with the `--static` flag?

Thanks.

---

<div class="post-metadata">

**Author:** ![asterite](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/asterite/32/60_2.png) [@asterite](https://forum.crystal-lang.org/u/asterite)\
**Post date:** [August 10, 2020, 5:20pm UTC](https://forum.crystal-lang.org/t/file-path-when-static-build/2432/2 "2020-08-10T17:20:34Z")

</div>

Hi!

What do you want to do?

---

<div class="post-metadata">

**Author:** ![jhass](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/jhass/32/1779_2.png) [@jhass](https://forum.crystal-lang.org/u/jhass)\
**Post date:** [August 11, 2020, 11:43am UTC](https://forum.crystal-lang.org/t/file-path-when-static-build/2432/3 "2020-08-11T11:43:45Z")

</div>

`--static` or not is irrelevant.

- ` __FILE__ ` is the path to the current source code file.
- ` __DIR__ ` is the path to the directory containing the current source code file.
- `PROGRAM_NAME` is what a lot of other environments expose as `$0` or the first argv element.
- `Process.executable_path` is the path to the invoked binary.

---

<div class="post-metadata">

**Author:** ![takanotume24](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/takanotume24/32/682_2.png) [@takanotume24](https://forum.crystal-lang.org/u/takanotume24)\
**Post date:** [August 13, 2020, 1:31pm UTC](https://forum.crystal-lang.org/t/file-path-when-static-build/2432/4 "2020-08-13T13:31:30Z")

</div>

Thanks for the answers, both of you!  
I’m building a CLI tool and wanted to know the path of the binary currently running, regardless of the current directory.  
So what I needed was a “Process.executable\_path”. Thank you, that was very helpful.
