Hi Thorsten,

> Ok, but then the question remains how to get (in a program) the absolute
> path to the PicoLisp installation the programs runs in when you assume a
> local installation was invoked - but you have no idea how?
> 
> I thought about combining (cmd) and (path ...), but that doesn't help either

How about (pwd) and (path ...)?

   : (pack (pwd) "/" (path "@lib/misc.l"))

If a local installation is invoked, then the path must be relative to
the current working directory.


A minor drawback is that the resulting path may contain "..", e.g.:

   $ ../../pil +
   : (path "@lib/misc.l")
   -> "../../lib/misc.l"

   : (pack (pwd) "/" (path "@lib/misc.l"))
   -> "/bla/laber/picoLisp/foo/bar/../../lib/misc.l"


To make it practically useful, it should work transparently for both
local and global installations. For that, I would recommend:

   : (let P (path "@lib/misc.l")
      (or
         (pre? "/" P)
         (pack (pwd) "/" P) ) )

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to