[erlang-questions 43] code:lib_dir and .ez archives

Ulf Wiger <>
Sun Mar 27 01:06:58 CET 2011


I packed up EQC Mini and PropEr as a single archive to make it easier to include in an OSS project.

http://github.com/esl/run_eqc

This works very well, except when compiling modules that require the eqc/proper .hrl files. The -include_lib/1 directive doesn't work if the .hrl is inside an archive.

This made me think that the compiler - actually probably file.erl - should support paths where a component is an .ez archive, and do the sensible thing (act as if it were a real path).

But first, I noticed that code:lib_dir/1 acts very strangely when the application is loaded from an .ez archive (see below).

Is this deliberate, or is it a bug?

BR,
Ulf W

$ erl -pa run_proper.ez/proper/ebin
Erlang R14B (erts-5.8.1) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.1  (abort with ^G)
1> code:which(proper).
"run_proper.ez/proper/ebin/proper.beam"
2> code:lib_dir(proper).
"./run_proper"
3> {ok,Z} = zip:zip_open("run_proper.ez",[memory]). 
{ok,<0.35.0>}
4> zip:zip_get("proper/include/proper.hrl",Z).
{ok,{"proper/include/proper.hrl",
     <<"%%% Copyright 2010 Manolis Papadakis ()\n%%%            and Kostis Sagonas (kostis"...>>}}
5> zip:zip_get("proper/ebin/proper.app",Z).   
{ok,{"proper/ebin/proper.app",
     <<"{application,proper,\n             [{description,\"A QuickCheck-inspired property-based testing tool f"...>>}}



Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com






More information about the erlang-questions mailing list