Commit 016e9fbb authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

Make system-relative-pathname more useful by accepting

the same string-as-pathname-specifiers as components.
parent ac7abaa5
......@@ -147,7 +147,7 @@
:use '(:common-lisp :asdf-utilities)
:unintern '(#:*asdf-revision* #:around #:asdf-method-combination #:split #:make-collector)
:fmakunbound '(#:perform #:explain #:output-files #:operation-done-p
#:component-relative-pathname)
#:component-relative-pathname #:system-relative-pathname)
:export
'(#:defsystem #:oos #:operate #:find-system #:run-shell-command
#:system-definition-pathname #:find-component ; miscellaneous
......@@ -2071,13 +2071,12 @@ output to `*verbose-out*`. Returns the shell's exit code."
:directory (relativize-directory (pathname-directory p))
:defaults p)))
(defun system-relative-pathname (system pathname &key name type)
(let ((directory (pathname-directory pathname)))
(merge-pathnames*
(make-pathname :name (or name (pathname-name pathname))
:type (or type (pathname-type pathname))
:directory (relativize-directory directory))
(system-source-directory system))))
(defun system-relative-pathname (system name &key type)
(merge-pathnames*
(merge-component-name-type
:name name
:type type)
(system-source-directory system)))
;;; ---------------------------------------------------------------------------
......
......@@ -1803,7 +1803,6 @@ for the sake of keeping ASDF no more complex than strictly necessary.
@section TODO
@itemize
@item Integrate into the rest of the documentation.
@item Add examples
@item Add proper defaults.
@item Get inspired by the XDG base directory specification?
......@@ -1821,7 +1820,7 @@ Thanks to Rommel Martinez for the initial implementation attempt.
All bad design ideas and implementation bugs are to mine, not theirs.
But so are good design ideas and elegant implementation tricks.
-- Francois-Rene Rideau @email{fare@@tunes.org}, Mon, 22 Feb 2010 00:07:33 -0500
--- Francois-Rene Rideau @email{fare@@tunes.org}, Mon, 22 Feb 2010 00:07:33 -0500
......@@ -2231,10 +2230,16 @@ It returns a pathname built from the location of the system's source file
and the relative pathname. For example
@lisp
> (asdf:system-relative-pathname 'cl-ppcre "regex.data")
> (asdf:system-relative-pathname 'cl-ppcre #p"regex.data")
#P"/repository/other/cl-ppcre/regex.data"
@end lisp
Instead of a pathname, you can provide a symbol or a string,
and optionally a keyword argument @code{type}.
The arguments will then be interpreted in the same way
as pathname specifiers for components.
@xref{The defsystem grammar,,Pathname specifiers}.
@end enumerate
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment