[erlang-questions] Retrieving priv directory path

Nikola Skoric nskoric@REDACTED
Wed Oct 26 01:42:30 CEST 2011


What would be universal way to get priv dir path?

Currently I retrieve priv dir like this:

priv_dir(App) ->
    case code:priv_dir(App) of
        {error, bad_name} ->
            {ok, Cwd} = file:get_cwd(),
            Cwd ++ "/" ++ "priv/";
        Priv ->
            Priv ++ "/"
    end.

First case is when I develop code, it does not work when I make a
release. When I make a release, core:priv_dir returns {error,
bad_name} because application:get_application returns something that
core:priv_dir doesn't agree with.

So, how do you do it?

Regards,
Nikola

-- 
"Strange women lying in ponds distributing swords is no basis for a
system of government."



More information about the erlang-questions mailing list