Erlang/OTP Forums

Author Message

<  Erlang questions mailing list  ~  passing an include path to escript

Guest
Posted: Thu Sep 10, 2009 8:26 pm Reply with quote
Guest
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

Post received from mailinglist
kagato
Posted: Thu Sep 10, 2009 8:51 pm Reply with quote
User Joined: 30 Dec 2007 Posts: 85
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
>


________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Post received from mailinglist
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum