Search code examples
erlangrebarrebar3

Rebar3: How do I refer to source artifacts of a library from erlang?


I have have library with an artifact: src/lib/prelude.kind that I'd like to access. However, when I call the library code from a different project (which has the library set up as a dependency), the file src/lib/prelude.kind doesn't exist.

I can solve this problem by hardcoding the file location as _build/default/lib/kind/src/prelude.kind instead, but I'd rather not hardcode the Rebar3 default profile path.

Is there a way to refer to _build/default/lib or whatever the current profile location is from Erlang in a Rebar3 project?


Solution

  • You should use code:lib_dir/2

    I'd make sure that the file is available with rebar3's artifacts (and move it out of the src subdir)