From cddd23053eb4b7ab10c8fd7ef168999b2d8b53a2 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Fri, 7 Oct 2016 20:29:08 -0500 Subject: [PATCH] Add Root Directory Of A Project as an elixir til --- README.md | 3 ++- elixir/root-directory-of-a-project.md | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 elixir/root-directory-of-a-project.md diff --git a/README.md b/README.md index 7173c47..f7d3f4a 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/elixir/root-directory-of-a-project.md b/elixir/root-directory-of-a-project.md new file mode 100644 index 0000000..f7e964b --- /dev/null +++ b/elixir/root-directory-of-a-project.md @@ -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)