Re: logical pathname help



On Wed, 06 Dec 2006 20:57:03 +0100, Thomas A. Russ <tar@xxxxxxxxxxxxx> wrote:

Pascal Bourguignon <pjb@xxxxxxxxxxxxxxxxx> writes:

Nobody complains that a CL pathname operation gives different results
on a different file system.

What we complain, is that two different implementations on the same OS
with the same file system give different results.

But when does this happen?

a) When using standard MAKE-PATHNAME and friends?

b) When using logical pathnames according to the standard, limited to
using only uppdercase letters, digits and hyphens?

c) When using logical pathnames not according to the standard, but with
some implementation-defined extension?

It is certainly the case that the logical-pathname translations work
differently on different lisp implementations, which effectively means
that even on the same platform, you may need separate translation
declarations depending on the lisp implementation.


To sum up a few things I figured out:

There is no way to generalize the production of all direcories on all
platforms in all compilers.
However it helps matters in common cases.

Here is a example of a common use:

(defparameter *game-help-directory*
(merge-pathnames
(make-pathname :directory '(:RELATIVE "game" "help"))
(user-homedir-pathname)))

All standard ANSI CL.
Works at least on Windows and Unix and under ACL and LispWorks.

Here I build on the last example:

(defun game-help (subject)
(check-type subject string)
(let ((filename (merge-pathnames
(make-pathname :name subject :type "hlp")
*game-help-directory*)))
(dump-file filename)))

A bit more verbose than I would like but workable.

Here is the biggest discrepancy under windows.

For Lispworks:
(pathname-host (user-homedir-pathname)) -> C

For the others:
(pathname-device (user-homedir-pathname)) -> C

So take care if reading from DVD/CDROM say.

Compilers tend to return (pathname-host ..) -> nil even though that is questionable
under the standard.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
.



Relevant Pages

  • Re: future C standards
    ... Those functions have no business in a no file system C implementation. ... implementation needn't support, or any other standard header ... required only for hosted implementations, i.e., ones that already must ...
    (comp.std.c)
  • Re: Requesting advice how to clean up C code for validating string represents integer
    ... Linkname: c standard - clc-wiki ... with a signed zero (including all IEC 60559 implementations) ... that follow the specification of annex G, the sign of zero ... between brake pedal and brake pads being through a complicated ...
    (comp.lang.c)
  • Re: Storgae durations
    ... standard you referred to is no longer current. ... advocating C99 and saying that C90 is obsolete, ... Then you are in no position to make an argument about C99's portability ... there are implementations for C99 that target those platforms. ...
    (comp.lang.c)
  • Re: idea: on the issue of C and language extensions
    ... features; this route would be based mostly on something like a mailing ... implementations, yet far lighter weight and informal than forcing ... extensions they have done already... ... When parts of the Standard released by such a major organisation like ...
    (comp.std.c)
  • Re: C program to automatically press F6 every few seconds
    ... where in the standard does it state that it implementations may ... the terminating new-line character on the last line may be optional. ... >>>prompt overwrites the last line when not so terminated. ...
    (comp.lang.c)