Changeset 5021


Ignore:
Timestamp:
Aug 25, 2006, 7:18:10 PM (18 years ago)
Author:
Gary Byers
Message:

FULL-PATHNAME: remove some weird old code that assumed that interfered
with handling of relative logical pathnames.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-pathnames.lisp

    r4156 r5021  
    669669(setup-initial-translations)
    670670
    671 ;;;This function should be changed to standardize the name more than
    672 ;;;it does.  It should eliminate non-leading instances of "::" etc at
    673 ;;;least.  We might also want it to always return an absolute pathname
    674 ;;;(i.e. fill in the default mac directory), so as to make it a sort
    675 ;;;of harmless truename (which is how I think it's mainly used).
    676 ;;;Unfortunately that would make it go to the file system, but it
    677 ;;;might be worth it.  This function used to also remove quoting so as
    678 ;;;to make the name suitable for passing to rom.  It doesn't
    679 ;;;anymore. Use mac-namestring for that.  does anybody use this??  DO
    680 ;;;- merge in default if relative, and do the :: stuff perhaps call it
    681 ;;;expand-pathname or expanded-pathname
    682 
     671
     672;;; Translate the pathname; if the directory component of the result
     673;;; is relative, make it absolute (relative to the current directory.)
    683674(defun full-pathname (path &key (no-error t))
    684   (let ((orig-path path))
    685     (cond (no-error
    686            ; note that ignore-errors wont work until var %handlers% is defined (in l1-init)
    687            (setq path (ignore-errors
    688                        (translate-logical-pathname (merge-pathnames path))))
    689            (when (null path) (return-from full-pathname nil)))
    690           (t (setq path (translate-logical-pathname (merge-pathnames path)))))
    691     (let* ((ihost (pathname-host orig-path))
    692            (dir (%pathname-directory path)))
    693       (when (and no-error (not dir) (%pathname-directory path)) ; WHAT is  that noop - since 3.0??
    694         (return-from full-pathname nil))
    695       (when (and ihost (neq ihost :unspecific))  ; << this is new. is it right?
    696         (if (eq (car dir) :relative)  ; don't make relative to mac-default-dir if had a host???
    697           (setq dir (cons :absolute (cdr dir)))))
    698       (setq dir (absolute-directory-list dir))     
    699       (unless (eq dir (%pathname-directory path))
    700         (setq path (cons-pathname dir (%pathname-name path) (%pathname-type path)
    701                                   (pathname-host path) (pathname-version path))))
    702       path)))
    703 
     675  (let* ((path (handler-case (translate-logical-pathname (merge-pathnames path))
     676                 (error (condition) (if no-error
     677                                      (return-from full-pathname nil)
     678                                      (error condition)))))
     679         (dir (%pathname-directory path)))
     680    (if (eq (car dir) :absolute)
     681      path
     682      (cons-pathname (absolute-directory-list dir)
     683                       (%pathname-name path)
     684                       (%pathname-type path)
     685                       (pathname-host path)
     686                       (pathname-version path)))))
    704687
    705688
Note: See TracChangeset for help on using the changeset viewer.