From bd47169892f4ba3d95df2af28701cdcc8de43f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 16 Sep 2022 17:54:28 +0200 Subject: [PATCH] Add information on __DIR__ and __ENV__ --- .../notebook/explore/elixir_and_livebook.livemd | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/livebook/notebook/explore/elixir_and_livebook.livemd b/lib/livebook/notebook/explore/elixir_and_livebook.livemd index 98759d804..a8a7a3cc1 100644 --- a/lib/livebook/notebook/explore/elixir_and_livebook.livemd +++ b/lib/livebook/notebook/explore/elixir_and_livebook.livemd @@ -41,6 +41,16 @@ return the Elixir version. Note you can also press tab to cycle across the completion alternatives. +## Getting the current directory + +You can access the location of the current `.livemd` file and +its current directory using `__ENV__` and `__DIR__` variables: + +```elixir +IO.puts(__ENV__.file) +IO.puts(__DIR__) +``` + ## Runtimes Livebook has a concept of **runtime**, which in practice is an Elixir node responsible