On Thu, 18 Aug 2016, Artur T. wrote:
 I am writing a package "A" which makes use of another
external gretl
 package "B". At some stage I need to load "B" via "include
B.gfn".
 However, I would like to check first whether B.gfn is already installed
 on the machine. If not I want to conduct the "install B.gfn" command.
 The problem is that "catch include B.gfn" doesn't seem to work
 currently. Is there any way to realize this? 
Hmm, in principle "catch" ought to work with "include", so I suppose 
that's a bug and should be fixed. In the meantime, however, you could 
use the readfile() function:
<hansl>
fname = sprintf("%s/functions/foo.gfn", $gretldir)
catch readfile(fname)
if $error
   printf "couldn't open %s\n", fname
else
   printf "opened %s OK\n", fname
endif
</hansl>
This isn't entirely satisfactory, however, since "include" does some 
path-searching that would be tedious to emulate; the above will only 
catch packages installed in the primary system location.
Allin Cottrell