PageRenderTime 13ms CodeModel.GetById 10ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/erlydtl/erlydtl_deps.erl

https://code.google.com/p/zotonic/
Erlang | 60 lines | 9 code | 5 blank | 46 comment | 0 complexity | 48855e2acd4f26550fc1ab4301b528e3 MD5 | raw file
 1%%%-------------------------------------------------------------------
 2%%% File:      erlydtl_deps.erl
 3%%% @author    Roberto Saccon <rsaccon@gmail.com> [http://rsaccon.com]
 4%%% @author    Evan Miller <emmiller@gmail.com>
 5%%% @copyright 2008 Roberto Saccon, Evan Miller
 6%%% @doc  
 7%%% ErlyDTL helper module
 8%%% @end  
 9%%%
10%%% The MIT License
11%%%
12%%% Copyright (c) 2007 Roberto Saccon, Evan Miller
13%%%
14%%% Permission is hereby granted, free of charge, to any person obtaining a copy
15%%% of this software and associated documentation files (the "Software"), to deal
16%%% in the Software without restriction, including without limitation the rights
17%%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18%%% copies of the Software, and to permit persons to whom the Software is
19%%% furnished to do so, subject to the following conditions:
20%%%
21%%% The above copyright notice and this permission notice shall be included in
22%%% all copies or substantial portions of the Software.
23%%%
24%%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25%%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26%%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27%%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28%%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29%%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30%%% THE SOFTWARE.
31%%%
32%%% @since 2007-12-16 by Roberto Saccon, Evan Miller
33%%%-------------------------------------------------------------------
34-module(erlydtl_deps).
35-author('rsaccon@gmail.com').
36-author('emmiller@gmail.com').
37
38%% API
39-export([get_base_dir/0, get_base_dir/1]).
40
41%%====================================================================
42%% API
43%%====================================================================
44%% @spec get_base_dir(Module) -> string()
45%% @doc Return the application directory for Module. It assumes Module is in
46%%      a standard OTP layout application in the ebin or src directory.
47get_base_dir(Module) ->
48    {file, Here} = code:is_loaded(Module),
49    filename:dirname(filename:dirname(Here)).
50
51%% @spec get_base_dir() -> string()
52%% @doc Return the application directory for this application. Equivalent to
53%%      get_base_dir(?MODULE).
54get_base_dir() ->
55    get_base_dir(?MODULE).
56    
57%%====================================================================
58%% Internal functions
59%%====================================================================
60