[Cl-darcs-cvs] r45 - cl-darcs/trunk
mhenoch at common-lisp.net
mhenoch at common-lisp.net
Fri Oct 6 19:18:24 UTC 2006
Author: mhenoch
Date: Fri Oct 6 15:18:24 2006
New Revision: 45
Modified:
cl-darcs/trunk/util.lisp
Log:
Add function pathname-to-string
Modified: cl-darcs/trunk/util.lisp
==============================================================================
--- cl-darcs/trunk/util.lisp (original)
+++ cl-darcs/trunk/util.lisp Fri Oct 6 15:18:24 2006
@@ -201,6 +201,21 @@
(make-pathname :directory (cons :relative directory)
:name filename-without-dot :type type))))))
+(defun pathname-to-string (pathname)
+ "Convert PATHNAME to a string usable in darcs patch files.
+PATHNAME is assumed to be a relative pathname going strictly down,
+as returned by SANITIZE-FILENAME."
+ (apply #'concatenate 'string
+ "./"
+ (append
+ (mapcan (lambda (d)
+ (list d "/"))
+ (cdr (pathname-directory pathname)))
+ (when (pathname-name pathname)
+ (cons (pathname-name pathname)
+ (when (pathname-type pathname)
+ (list "." (pathname-type pathname))))))))
+
(defun make-dir (pathname)
"Create directory PATHNAME."
(with-simple-restart (ignore-error "Ignore ~A directory creation error." pathname)
More information about the Cl-darcs-cvs
mailing list