Reputation: 2829
I not sure or I'm unaware of the conventional way that erlang locates a module which isn't located in the default directories. I understand it will look in the compiled folder and erlang's system folders or the folders that - lists:foreach(fun (E) -> io:fwrite("Path: ~s~n", [E]) end, code:get_path()) will produce.
Path: .
Path: /usr/lib64/erlang/lib/kernel-2.16.3/ebin
Path: /usr/lib64/erlang/lib/stdlib-1.19.3/ebin
Path: /usr/lib64/erlang/lib/xmerl-1.3.4/ebin
Path: /usr/lib64/erlang/lib/tv-2.1.4.10/ebin
Path: /usr/lib64/erlang/lib/tools-2.6.12/ebin
Path: /usr/lib64/erlang/lib/syntax_tools-1.6.11/ebin
Path: /usr/lib64/erlang/lib/sasl-2.3.3/ebin
Path: /usr/lib64/erlang/lib/odbc-2.10.17/ebin
Path: /usr/lib64/erlang/lib/observer-1.3.1.1/ebin
Path: /usr/lib64/erlang/lib/hipe-3.10.2.1/ebin
Path: /usr/lib64/erlang/lib/eunit-2.2.5/ebin
Path: /usr/lib64/erlang/lib/erts-5.10.3/ebin
Path: /usr/lib64/erlang/lib/edoc-0.7.12.1/ebin
Path: /usr/lib64/erlang/lib/dialyzer-2.6.1/ebin
Path: /usr/lib64/erlang/lib/debugger-3.2.12/ebin
Path: /usr/lib64/erlang/lib/compiler-4.9.3/ebin
But what's the conventional method for adding additional folders to the default paths or how do you inform a module that it must look elsewhere for a module that isn't included in the default paths?
Upvotes: 3
Views: 896
Reputation: 681
Check out code:add_path(Directory)
to append a directory to the module load paths. Also see http://erldocs.com/current/kernel/code.html?i=1&search=code:add#add_path/1 for other related functions for adding code paths.
You can also tell Erlang where to find modules by exporting the ERL_LIBS
environment variable with a colon-separated list of directories. Each directory should point to an OTP project with an ebin directory where the compiled .beam
files are located.
Upvotes: 1
Reputation: 10841
You can set the ERL_LIBS
environment variable in your system to look for additional library files.
Upvotes: 4