1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-02 22:58:01 +00:00

Add Root Directory Of A Project as an elixir til

This commit is contained in:
jbranchaud
2016-10-07 20:29:08 -05:00
parent 4991113ff4
commit cddd23053e
2 changed files with 17 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really
warrant a full blog post. These are mostly things I learn by pairing with
smart people at [Hashrocket](http://hashrocket.com/).
_478 TILs and counting..._
_479 TILs and counting..._
---
@@ -100,6 +100,7 @@ _478 TILs and counting..._
- [Quitting IEx](elixir/quitting-iex.md)
- [Replace Duplicates In A Keyword List](elixir/replace-duplicates-in-a-keyword-list.md)
- [Reversing A List](elixir/reversing-a-list.md)
- [Root Directory Of A Project](elixir/root-directory-of-a-project.md)
- [Round Floats To Integers](elixir/round-floats-to-integers.md)
- [Run ExUnit Tests In A Deterministic Order](elixir/run-exunit-tests-in-a-deterministic-order.md)
- [String Interpolation With Just About Anything](elixir/string-interpolation-with-just-about-anything.md)

View File

@@ -0,0 +1,15 @@
# Root Directory Of A Project
Do you need the root directory of an elixir project? The
[`File.cwd!/0`](http://elixir-lang.org/docs/stable/elixir/File.html#cwd!/0)
function can help.
```elixir
iex> File.cwd!
"/home/dev/code/my_app"
```
Keep in mind though, this will only work reliably with projects that are
compiled using Mix.
[source](https://groups.google.com/forum/#!msg/elixir-lang-talk/Ls0eJDdMMW8/1Lmg5K2MAQAJ)