Changeset 123


Ignore:
Timestamp:
08/24/07 04:42:52 (18 years ago)
Author:
Magnus Henoch
Message:

Add PATHNAME-SANE-P and use it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified cl-darcs/trunk/util.lisp

    r107 r123  
    1 ;;; Copyright (C) 2006 Magnus Henoch
     1;;; Copyright (C) 2006, 2007 Magnus Henoch
    22;;;
    33;;; This program is free software; you can redistribute it and/or
     
    226226                        :name filename-without-dot :type type))))))
    227227
     228(defun pathname-sane-p (pathname)
     229  "Return true if PATHNAME is a relative path going strictly down."
     230  (let ((directory (pathname-directory pathname)))
     231    (and (listp directory)
     232         (eql (car directory) :relative)
     233         (every #'stringp (cdr directory)))))
     234
    228235(defun pathname-to-string (pathname)
    229236  "Convert PATHNAME to a string usable in darcs patch files.
    230237PATHNAME is assumed to be a relative pathname going strictly down,
    231238as returned by SANITIZE-FILENAME."
     239  (assert (pathname-sane-p pathname))
    232240  (apply #'concatenate 'string
    233241         "./"
Note: See TracChangeset for help on using the changeset viewer.