Lisp HUG Maillist Archive

Logical Pathnames - Looking for advice

Hello,

I find useful the possibility to abstract out a specific location using logical pathnames.  I can use the same pathname, for example, to refer to the directory where I store dynamic libraries.  Wether the application runs in the LW IDE or is deployed on OS X or Windows, my code still use the same pathnames.

Now, I am not familiar with how all this works, or has historically worked on Lisp machines, but I can see the LW library directory contains a "translations" directory in which there is a single translation at the moment for the Editor sources:

  (setf (logical-pathname-translations "EDITOR-SRC")
        `(("*" ,(merge-pathnames 
                 (make-pathname :name :wild :directory '(:relative "src" "editor"))
                 (sys:lisp-library-directory)))))


While this makes sense for site-wide configuration, it does not seem to apply for delivered products.

So, here's my question:  If you use or were using logical pathname translations, where is the best place to put the configuration code (such as the one above) for development and delivery?  What's your approach?

I'd like to know if there are best practices regarding this question, and trying not reinvent the wheel.


Best,
Cam


_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: Logical Pathnames - Looking for advice

Camille Troillard <camille@osculator.net> writes:

> Hello,
>
> I find useful the possibility to abstract out a specific location
> using logical pathnames.  I can use the same pathname, for example, to
> refer to the directory where I store dynamic libraries.  Wether the
> application runs in the LW IDE or is deployed on OS X or Windows, my
> code still use the same pathnames.
>
> Now, I am not familiar with how all this works, or has historically
> worked on Lisp machines, but I can see the LW library directory
> contains a "translations" directory in which there is a single
> translation at the moment for the Editor sources:
>
>   (setf (logical-pathname-translations "EDITOR-SRC")
>         `(("*" ,(merge-pathnames 
>                  (make-pathname :name :wild :directory '(:relative "src" "editor"))
>                  (sys:lisp-library-directory)))))
>
>
> While this makes sense for site-wide configuration, it does not seem
> to apply for delivered products.
>
> So, here's my question:  If you use or were using logical pathname
> translations, where is the best place to put the configuration code
> (such as the one above) for development and delivery?  What's your
> approach?
>
> I'd like to know if there are best practices regarding this question,
> and trying not reinvent the wheel.

I'm lazy and tired in this evening, so I won't check the documentation
of Lispworks, but with most other implementations, the directory (or
directories) where LOAD-LOGICAL-PATHNAME-TRANSLATIONS will search
logical translations files can be customized.  Most implementations use
the same format for this file (how lucky of us!) and they can be
configured to look up those files in a directory in
user-homedir-pathname.  For example, ~/LOGHOSTS/.

Then, "installing" an application would just involve creating a logical
pathname translation file for the logical host or hosts specific to that
application in this directory.

~/LOGHOST/MYAPP

contains:

(("MYAPP:**;*.*" "/opt/myapp/**/*.*")
 ("MYAPP:**;*"   "/opt/myapp/**/*"))



(load-logical-pathname-translations "MYAPP")
(load #P"MYAPP:BIN;MYAPP")



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: Logical Pathnames - Looking for advice

On Jan 30, 2013, at 18:46 , Camille Troillard <camille@osculator.net> wrote:
> 
> Hello,
> 
> I find useful the possibility to abstract out a specific location using logical pathnames.  I can use the same pathname, for example, to refer to the directory where I store dynamic libraries.  Wether the application runs in the LW IDE or is deployed on OS X or Windows, my code still use the same pathnames.
> 
> Now, I am not familiar with how all this works, or has historically worked on Lisp machines, but I can see the LW library directory contains a "translations" directory in which there is a single translation at the moment for the Editor sources:
> 
>  (setf (logical-pathname-translations "EDITOR-SRC")
>        `(("*" ,(merge-pathnames 
>                 (make-pathname :name :wild :directory '(:relative "src" "editor"))
>                 (sys:lisp-library-directory)))))
> 
> 
> While this makes sense for site-wide configuration, it does not seem to apply for delivered products.
> 
> So, here's my question:  If you use or were using logical pathname translations, where is the best place to put the configuration code (such as the one above) for development and delivery?  What's your approach?
> 
> I'd like to know if there are best practices regarding this question, and trying not reinvent the wheel.


I'm not sure that I understand your question, so the following may not be the answer you're looking for... it's also possibly not best practice.

If I wanted to set up logical pathname translations for delivered products, I'd use (lw:current-pathname) to get the pathname for the delivered executable, and possibly (hcl:delivered-image-p) to distinguish between settings appropriate in the development environment and settings for the delivered product.




_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: Logical Pathnames - Looking for advice

Hi,

one of the mechanisms for initializing more complex applications is called 'Action Lists'.

See Chapter 8 of the LispWorks User Guide and Reference Manual (LispWorks 6.1).

There is for example an action list for starting an image.

You can define an action for an action list which then gets executed when you start that image.
Such an action could for example set logical pathname translations based on the current location of the executable (or loading a translations file or looking into the file system, …). So the logic would be a part of your application and would run from an action list…

Regards,

Rainer Joswig




Am 30.01.2013 um 18:46 schrieb Camille Troillard <camille@osculator.net>:

> 
> Hello,
> 
> I find useful the possibility to abstract out a specific location using logical pathnames.  I can use the same pathname, for example, to refer to the directory where I store dynamic libraries.  Wether the application runs in the LW IDE or is deployed on OS X or Windows, my code still use the same pathnames.
> 
> Now, I am not familiar with how all this works, or has historically worked on Lisp machines, but I can see the LW library directory contains a "translations" directory in which there is a single translation at the moment for the Editor sources:
> 
>  (setf (logical-pathname-translations "EDITOR-SRC")
>        `(("*" ,(merge-pathnames 
>                 (make-pathname :name :wild :directory '(:relative "src" "editor"))
>                 (sys:lisp-library-directory)))))
> 
> 
> While this makes sense for site-wide configuration, it does not seem to apply for delivered products.
> 
> So, here's my question:  If you use or were using logical pathname translations, where is the best place to put the configuration code (such as the one above) for development and delivery?  What's your approach?
> 
> I'd like to know if there are best practices regarding this question, and trying not reinvent the wheel.
> 
> 
> Best,
> Cam
> 
> 
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> lisp-hug@lispworks.com
> http://www.lispworks.com/support/lisp-hug.html


_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Updated at: 2020-12-10 08:36 UTC