[erlang-questions] passing an include path to escript

zabrane Mikael zabrane3@REDACTED
Fri Jan 22 10:38:22 CET 2010


Hi Sergey,

As "Nick Genrakines" show me the trick, here is a working solution:

1. assume your code lives inside "mycode" directory
2. assume your .hrl lives inside an "include" directory
mycode
|________include: my.hrl
3. Then, your escript could simply include that .hrl like this:

#!/usr/bin/env escript
%% -*- erlang -*-
%%! -pz ../mycode ebin

-include_lib("mycode/include/my.hrl").

Regards
Zabrane


2010/1/22 Sergey Samokhin <ad.sergey@REDACTED>

> On Tue, Dec 1, 2009 at 8:37 PM, zabrane Mikael <zabrane3@REDACTED> wrote:
> > Hi List !
> >
> > I'm facing the same issue as "Wojtek" here:
> >
> http://forum.trapexit.org/viewtopic.php?p=48544&sid=d7fe0c082bbea7b130d30713a2925491
> >
> > Could someone please,  show us a clean way to add relative paths to our
> > ".hrl"files which are outside "lib_dir"?
>
> Does anybody know, are there any plans on allowing "include" to be
> used inside escripts?
>
> I'm writing a small library for parsing CLI arguments. I think
> specifications looks much simplier to understand,
> if they a list of records:
>
> Specs =
> [
>    #opt{long_name = help,
>           short_name = h,
>           type = boolean},
>    #opt{long_name = version,
>           short_name = v,
>           type = boolean,
>           validator = fun(_Val) -> ok end}
> ]
>
> than a list of tuples:
>
> Specs =
>    [{help, [{short_name, h}, {type, boolean}]},
>     {version, [{short_name, v}, {type, boolean}, {validator,
> fun(_Val) -> ok end}]]
>
> Currently the only way to specify which options to get is by using
> list of tuples.
>
> --
> Sergey
>


More information about the erlang-questions mailing list