(defvar +back-path+ (make-pathname :directory '(:relative :back))
"logical parent path")
-(defun pathname-directory-pathname (pathname)
- (make-pathname :type nil :name nil :version nil :defaults pathname))
-
(defun pathname-base-pathname (pathname)
(make-pathname :directory nil :defaults pathname))
-(defun merge-pathnames* (specified &optional (defaults *default-pathname-defaults*))
- "MERGE-PATHNAMES* is like MERGE-PATHNAMES except that if the SPECIFIED pathname
-does not have an absolute directory, then the HOST and DEVICE come from the DEFAULTS.
-Also, if either argument is NIL, then the other argument is returned unmodified."
- ;; Same as in ASDF 2.
- (when (null specified) (return-from merge-pathnames* defaults))
- (when (null defaults) (return-from merge-pathnames* specified))
- (let* ((specified (pathname specified))
- (defaults (pathname defaults))
- (directory (pathname-directory specified))
- (directory (if (stringp directory) `(:absolute ,directory) directory))
- (name (or (pathname-name specified) (pathname-name defaults)))
- (type (or (pathname-type specified) (pathname-type defaults)))
- (version (or (pathname-version specified) (pathname-version defaults))))
- (labels ((ununspecific (x)
- (if (eq x :unspecific) nil x))
- (unspecific-handler (p)
- (if (typep p 'logical-pathname) #'ununspecific #'identity)))
- (multiple-value-bind (host device directory unspecific-handler)
- (ecase (first directory)
- ((nil)
- (values (pathname-host defaults)
- (pathname-device defaults)
- (pathname-directory defaults)
- (unspecific-handler defaults)))
- ((:absolute)
- (values (pathname-host specified)
- (pathname-device specified)
- directory
- (unspecific-handler specified)))
- ((:relative)
- (values (pathname-host defaults)
- (pathname-device defaults)
- (append (pathname-directory defaults) (cdr directory))
- (unspecific-handler defaults))))
- (make-pathname :host host :device device :directory directory
- :name (funcall unspecific-handler name)
- :type (funcall unspecific-handler type)
- :version (funcall unspecific-handler version))))))
-
(defun pathname-parent (pathname)
"Takes a pathname and returns the pathname of the parent directory
of the directory of the given pathname"
(make-pathname :directory (unless (equal r '(:relative)) (nreverse r))
:name name :type type)))
+#|
(defun subpathname (path string)
(merge-pathnames*
(portable-pathname-from-string string :allow-absolute nil)
path))
+|#
(defun pathname-absolute-p (path)
"Assuming PATH is a pathname, is it an absolute pathname?"
(let ((directory (pathname-directory path)))
(and (consp directory) (eq (car directory) :absolute))))
-(defun absolute-pathname-p (path)
- "Return true iff pathname P is an absolute pathname"
- (and (pathnamep path)
- (pathname-absolute-p path)))
-
(defun portable-namestring-absolute-p (namestring)
(eql (first-char namestring) #\/))