[erlang-questions] Re: file operations on zipped files (Re: how to add a module to preLoaded?)
Håkan Mattsson
hm@REDACTED
Tue Apr 5 15:43:33 CEST 2011
On Thu, Mar 31, 2011 at 8:04 PM, Ulf Wiger
<ulf.wiger@REDACTED> wrote:
> The change in prim_file gives no overhead in the normal case,
> except for an extra pattern-match on the error value, and - if
> {error, enotdir}, a scan of the file name to see if there is a
> .ez file in the path. If so, the corresponding action is mapped
> on the archive. If the file is to be opened, as with epp,
> a "read_file()" is done, and the contents moved into a
> ram_file, which allows the same operations as prim_file.
>
> For this last case, I needed prim_ram_file in preloaded…
Is erl_prim_loader:get_file(File) too slow for your needs?
> A minor quirk is that code:lib_dir/1 has been defined to return
> a path *outside* the zip archive, presumably because you cannot
> load DLLs from an archive. Epp uses code:lib_dir/1 too, so even
> with the above changes, epp would fail to find the .hrl
> files. I solved this by having epp call code:where_is_file(Lib
> ++ ".app") and then finding the include from there. If that
> fails, it calls code:lib_dir/1 as before.
Would it not be better if epp used code:lib_dir(App, include) instead?
> I've not written a proper commit message (or actually sent this
> to erlang-patches), nor have I updated documentation or written
> test suites. If this approach is rejected on principle, I'd
> rather not waste the time, so, feedback first, please.
/Håkan
More information about the erlang-questions
mailing list