How in Elixir can I specify the current file being compiled? In Ruby, I can use the __FILE__
variable. Is there an equivalent in Elixir?
Here is my script:
IO.puts “#{__FILE__}”
Here is the output:
** (CompileError) ModulesAndFunctions-7.exs:3: undefined function __FILE__/0
(elixir) expanding macro: Kernel.to_string/1
ModulesAndFunctions-7.exs:3: (file)
You can simply use __ENV__.file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With