Permalink
Browse files

use code:priv_dir to find application priv directory

In the application skeleton wmskel_sup.erl file, use the application name
and code:priv_dir to find the application priv directory rather than
cobbling the priv dir pathname together relative to the ebin dir.
  • Loading branch information...
vinoski committed Apr 30, 2012
1 parent 656aa69 commit b544a32c59520340d64da0202c2cd9fd0295d977
Showing with 3 additions and 3 deletions.
  1. +3 −3 priv/templates/src/wmskel_sup.erl
@@ -42,9 +42,9 @@ upgrade() ->
%% @doc supervisor callback.
init([]) ->
Ip = case os:getenv("WEBMACHINE_IP") of false -> "0.0.0.0"; Any -> Any end,
- {ok, Dispatch} = file:consult(filename:join(
- [filename:dirname(code:which(?MODULE)),
- "..", "priv", "dispatch.conf"])),
+ {ok, App} = application:get_application(?MODULE),
+ {ok, Dispatch} = file:consult(filename:join([code:priv_dir(App),
+ "dispatch.conf"])),
WebConfig = [
{ip, Ip},
{port, 8000},

0 comments on commit b544a32

Please sign in to comment.