Changeset 5668


Ignore:
Timestamp:
Jan 1, 2007, 10:41:48 PM (18 years ago)
Author:
Gary Byers
Message:

ENOUGH-NAMESTRING: don't incorporate version into returned namestring for physical
pathnames.

File:
1 edited

Legend:

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

    r5628 r5668  
    371371  (if (null defaults)
    372372    (namestring path)
    373       (let* ((dir (pathname-directory path))
    374              (nam (pathname-name path))
    375              (typ (pathname-type path))
    376              (ver (pathname-version path))
    377              (host (pathname-host path))
    378              (logical-p (neq host :unspecific))
    379              (default-dir (pathname-directory defaults)))
    380         ;; enough-host-namestring
    381         (setq host (if (and host
    382                             (neq host :unspecific)
    383                             (not (equalp host (pathname-host defaults))))
    384                      (%str-cat host ":")
    385                      ""))
    386         ;; enough-directory-namestring
    387         (cond ((equalp dir default-dir)
    388                (setq dir '(:relative)))
    389               ((and dir default-dir
    390                     (eq (car dir) :absolute) (eq (car default-dir) :absolute))
    391                ; maybe make it relative to defaults
    392                (do ((p1 (cdr dir) (cdr p1))
    393                     (p2 (cdr default-dir) (cdr p2)))
    394                    ((or (null p2) (null p1) (not (equalp (car p1) (car p2))))
    395                     (when (and (null p2) (neq p1 (cdr dir)))
    396                       (setq dir (cons :relative p1)))))))
    397         (setq dir (%directory-list-namestring dir logical-p))
    398         ;; enough-file-namestring
    399         (when (equalp ver (pathname-version defaults))
    400           (setq ver nil))
    401         (when (and (null ver) (equalp typ (pathname-type defaults)))
    402           (setq typ nil))
    403         (when (and (null typ) (equalp nam (pathname-name defaults)))
    404           (setq nam nil))
    405         (setq nam (file-namestring-from-parts nam typ ver))
    406         (%str-cat host dir nam))))
     373    (let* ((dir (pathname-directory path))
     374           (nam (pathname-name path))
     375           (typ (pathname-type path))
     376           (ver (pathname-version path))
     377           (host (pathname-host path))
     378           (logical-p (neq host :unspecific))
     379           (default-dir (pathname-directory defaults)))
     380      ;; enough-host-namestring
     381      (setq host (if (and host
     382                          (neq host :unspecific)
     383                          (not (equalp host (pathname-host defaults))))
     384                   (%str-cat host ":")
     385                   ""))
     386      ;; enough-directory-namestring
     387      (cond ((equalp dir default-dir)
     388             (setq dir '(:relative)))
     389            ((and dir default-dir
     390                  (eq (car dir) :absolute) (eq (car default-dir) :absolute))
     391                                        ; maybe make it relative to defaults
     392             (do ((p1 (cdr dir) (cdr p1))
     393                  (p2 (cdr default-dir) (cdr p2)))
     394                 ((or (null p2) (null p1) (not (equalp (car p1) (car p2))))
     395                  (when (and (null p2) (neq p1 (cdr dir)))
     396                    (setq dir (cons :relative p1)))))))
     397      (setq dir (%directory-list-namestring dir logical-p))
     398      ;; enough-file-namestring
     399      (when (or (equalp ver (pathname-version defaults))
     400                (not logical-p))
     401        (setq ver nil))
     402      (when (and (null ver) (equalp typ (pathname-type defaults)))
     403        (setq typ nil))
     404      (when (and (null typ) (equalp nam (pathname-name defaults)))
     405        (setq nam nil))
     406      (setq nam (file-namestring-from-parts nam typ ver))
     407      (%str-cat host dir nam))))
    407408
    408409(defun cons-pathname (dir name type &optional host version)
Note: See TracChangeset for help on using the changeset viewer.