[Openmcl-devel] "Native" namestrings

R. Matthew Emerson rme at clozure.com
Wed May 11 06:02:27 PDT 2011

On May 11, 2011, at 8:00 AM, Zach Beane wrote:

> CCL represents pathnames that have a dot in the pathname-name by
> escaping the dot with #\\ on Linux and #\> on Windows. What's the
> recommended way to get the "native" name of a pathname escaped like
> that, so that it could e.g. be passed as an argument to a system command
> and be recognized by a non-CL process? CCL::NATIVE-TRANSLATED-NAMESTRING
> looks like a possibility; is it what I should use? If so, should I be
> worried about the non-exportedness of it?
> Is the escaping/native convention described in the manual? I didn't see
> it under 4.6, "Pathnames", or in the index.

Yes, ccl:native-translated-namestring is the thing to use for this
case.  It is exported.

http://trac.clozure.com/ccl/ticket/632 talks about the namestring

If you need to turn that native namestring into a C-style string
that you're going to pass to a foreign function, one could use the
macro ccl:with-filename-cstrs to do so.

(with-filename-cstrs ((s (native-translated-namestring pathname)))
  (#_unlink s))

This only matters (currently) on Darwin and Windows.  Most other
systems just treat a POSIX-style pathname as a bunch of octets.
The VFS layer on Darwin expects pathnames to be decomposed UTF-8.
The unicode variants of certain Windows functions (e.g. #_CreateFileW)
want UTF-16.

This information should be in the manual.  I'll steel myself for
some DocBook editing...

More information about the Openmcl-devel mailing list