code:priv_dir()

Ulf Wiger <>
Wed Dec 5 16:26:39 CET 2001


On Wed, 5 Dec 2001, Bengt Kleberg wrote:

>> You can also use code:add_path("tmp/cnh2"), but it's probably
>> more natural to point the code server to where the actual code
>> resides. Either way, the directory that will be logged in the
>> code server table (code_names, which is private and can't be
>> inspected) is "tmp/cnh2".
>
>Not beeing very well versed in Erlang I really should not
>pretend to question someone that knows what he is talking
>about, but do you really mean that
>
>code:add_path("tmp/cnh2/ebin").
>and
>code:add_path("tmp/cnh2")
>
>will result in the same directory beeing logged in the code
>server table?

The same directory will be logged in the code server's name table
(code_names, which is used to resolve calls to code:priv_dir/1).
The path held by the code server will be updated with exactly the
directory that you supply in the call to code:add_path/1

What I meant was that if your objective with setting the path was
to find priv_dir, then it wouldn't matter if you called
code:add_path("tmp/cnh2/ebin") or code:add_path("tmp/cnh2").

If the objective is instead (as it usually is) to find the
compiled code, then setting the path to where the actual code is
will produce a much better result.  (:


/Uffe
-- 
Ulf Wiger, Senior Specialist,
   / / /   Architecture & Design of Carrier-Class Software
  / / /    Strategic Product & System Management
 / / /     Ericsson Telecom AB, ATM Multiservice Networks




More information about the erlang-questions mailing list