[Openmcl-devel] A platform independent pathname without truename

Robert Goldman rpgoldman at sift.info
Fri Jul 29 12:56:05 PDT 2011

On 7/29/11 Jul 29 -2:47 PM, Michael Minerva wrote:
> I have been trying to find a good way to return a platform independent pathname without using truename which works for cases where you are creating a path for a file that already exists, but would not work if you are trying to create a path to a file you are about to create.  For example if I call (truename "ccl:") on the mac I get: #P"/Users/Mike/ccl-1.7-dev-r14869/"
> and on the pc I get:
> #P"C:/Users/Mike/Desktop/ccl-windows-mar-30/"
> This is all well and good but I cannot use truename if I am trying to create a path for a directory I am trying to create inside the ccl directory (because truename will return an error if the file does not exists).  Is there anyway to get a platform independent path without using truename?  

It's not entirely clear to me what you want to do, but what about

(defun new-rel-path (rel-pathname)
   (merge-pathnames rel-pathname (truename "ccl:")))

Note that that's not enough to be *writeable*, because I could have done

(new-rel-path "foo/bar/baz")

when /Users/Mike/ccl-1.7-dev-r14869/foo/bar/ didn't exist....

That's why it would help if you would be more specific about what you want.


More information about the Openmcl-devel mailing list