When using this module attribute what path is supposed to be specified? Happy to create a PR when I get the answer, the docs don’t specify: https://hexdocs.pm/elixir/Module.html#module-external_resource.
I want to reference config/config.exs
in my application.
tmbb
2
It’s relative to the mix file.
4 Likes
ericmj
3
@tmbb is correct, it’s relative to the project directory, which is where the mix.exs file is located.
You can use the __DIR__
macro [1] to make it relative to the current file’s directory:
@external_resource Path.join(__DIR__, "file_in_the_same_directory.txt")
[1] https://hexdocs.pm/elixir/Kernel.SpecialForms.html#DIR/0
4 Likes