Re: Patch for finding the truename.
james anderson <[email protected]>
| Newsgroups | gmane.lisp.cclan.general |
|---|---|
| Message-ID | <[email protected]> |
On Monday, Oct 27, 2003, at 15:14 Europe/Berlin, Gary King wrote: > > (defun load-truename () > "Returns a pathname that is useful for merging with filenames to get > a > complete pathname for a file in the same directory as the one > currently being > loaded. This function is a more portable version of the Common Lisp > variable > *load-pathname*, since not all vendors implemented that correctly." > (let ((pn #+allegro (translate-logical-pathname (truename > excl:*source-pathname*)) 1. why does one not want to just use *load-truename* for this? 2. wouldn't digitool be needed for this does open-mcl also define the ccl:*loading-file-source-file* symbol. i recall submitting a 5.0b bug about fred behaviour, as digitool should really be binding *load-truename* rather than in implementation specific variable with parallel semantics, since they do all of the other things - like warning about redefinition, as if they were loading from a file. my memory was they they agreed - in principle, but i've never checked whether it made it into the release. i'm still using a wrapped fred command which does just that. > #+MCL (cond (*load-pathname* > (translate-logical-pathname > *load-pathname*)) > (ccl:*loading-file-source-file* > ;; This makes it work in a fred buffer... > (translate-logical-pathname > ccl:*loading-file-source-file*)) > (t > nil)) > #+Lispworks (translate-logical-pathname *load-pathname*) > #-(or allegro MCL Lispworks) > (translate-logical-pathname *load-pathname*))) > (assert (pathnamep pn) (pn) > "load-pathname* did not return a pathname, it returned ~s; > this might be because it executed in a context where you're not > loading a file > or because the file is in the current working directory. In any > event, this > will break the code in generic-load-utils, because it works with the > components > of pathnames." pn) > ;; Deal with the lispworks using an empty pathname for > *default-pathname-defaults* > ;; if you are loading from the current working directory. > (values > #-lispworks pn > #+lispworks > (if (null (pathname-directory pn)) > (merge-pathnames pn (current-pathname)) pn)))) > ... ------------------------------------------------------- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/