[erlang-questions] passing an include path to escript

Jayson Vantuyl kagato@REDACTED
Thu Sep 10 22:49:01 CEST 2009


According to the docs (and my tests), escript will only use - 
include_lib, not a regular -include.

The way to make that work is if you have the file in the code_path  
(hence, why it works for installed modules).  Since any modifications  
within the script happen after the -include_lib would be processed,  
you'll have to have the escript program set this path itself.

I can't find a way to do this.

I tried just giving it the flag that "erl" would take, didn't work.
I tried adding the flag via an environmental variable, also didn't  
work. (ERL_AFLAGS="-pa mypath")

When I use etap, I have my actual tests in a compiled module, so I  
don't have this problem.  That said, I don't know of any way to make  
this work.

I think the best way would be to add "-patha(...)" and "-pathz" to  
escript.

Anybody know how to get escript to modify its path?

Also, can anyone explain why -include() isn't allowed?

On Sep 10, 2009, at 1:25 PM, Wojciech Kaczmarek wrote:

> Hi!
>
> It there a way to instruct escript where to look for files to be  
> included?
> Right now it only seem to accept absolute paths or paths relative to a
> lib_dir of an installed library.
> It would be good to allow escript to include the files located in a
> place relative to where the script is being run.
>
> Real world example:
>
> escript is used to run etap[1] tests in a make test phase. As this is
> testing, no files are installed in an erlang tree yet, sadly it's
> impossible to use hrl files existing in the source (which would be
> installed thus accessible but after the tests pass..). Catch 22, isn't
> it?
>
> cheers,
> Wojtek
>
> [1] http://github.com/ngerakines/etap/tree/master
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>



More information about the erlang-questions mailing list