On Thu, 18 Aug 2016, Artur T. wrote:
I am writing a package "A" which makes use of another
package "B". At some stage I need to load "B" via "include
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:
fname = sprintf("%s/functions/foo.gfn", $gretldir)
printf "couldn't open %s\n", fname
printf "opened %s OK\n", fname
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.