(defun grail-sanitize-path ( path )
sanitize a load-path reducing redundant file separators to single
separators. The sanitized PATH is returned.
This situation: foo/bar/baz// has bombed (load file) for me.
(replace-regexp-in-string "/+" "/" path))
(defun file-path-if-readable ( file )
"return the path if the file is readable, otherwise nil"
(if (file-readable-p file)
(defun delete-trailing-path-separators ( path )
Delete any trailing separators from the path, returning the modified path.
((i (- (length path) 1)))
(while (and (> i 0) (char-equal ?/ (elt path i)))
(setq i (- i 1)))
(substring path 0 (+ i 1))))
(defun make-path-relative-to ( parent child )
((p (reverse (split-string parent "/" t)))
(c (reverse (split-string child "/" t)))
(while (not (equal (car c) (car p)))
(setq path (cons (car c) path))
(setq c (cdr c))
(concat (string-join "/" path) "/")))