#| -*-Scheme-*-
-$Id: dospth.scm,v 1.33 1996/02/27 21:53:06 cph Exp $
+$Id: dospth.scm,v 1.34 1996/02/28 23:30:20 cph Exp $
Copyright (c) 1992-96 Massachusetts Institute of Technology
(lambda (device components)
(call-with-values (lambda () (parse-name (car (last-pair components))))
(lambda (name type)
- (dos/make-pathname host
- device
- (let ((components (except-last-pair components)))
- (and (not (null? components))
- (simplify-directory
- (if (string=? "" (car components))
- (cons 'ABSOLUTE
- (map parse-directory-component
- (cdr components)))
- (cons 'RELATIVE
- (map parse-directory-component
- components))))))
- name
- type
- 'UNSPECIFIC))))))
+ (dos/make-pathname
+ host
+ device
+ (let ((components (except-last-pair components)))
+ (and (not (null? components))
+ (simplify-directory
+ (if (string-null? (car components))
+ (cons 'ABSOLUTE
+ (if (and (pair? (cdr components))
+ (string-null? (cadr components)))
+ (cons (cadr components)
+ (parse-directory-components
+ (cddr components)))
+ (parse-directory-components
+ (cdr components))))
+ (cons 'RELATIVE
+ (parse-directory-components components))))))
+ name
+ type
+ 'UNSPECIFIC))))))
(define (expand-directory-prefixes components)
(let ((string (car components))
(current-home-directory)
(user-home-directory user-name))))))
(else components)))))
-
+\f
(define (parse-device-and-path components)
(let ((string (car components)))
(let ((colon (string-find-next-char string #\:)))
((equal? '(ABSOLUTE UP) directory) '(ABSOLUTE))
(else directory)))
+(define (parse-directory-components components)
+ (map parse-directory-component
+ (list-transform-negative components string-null?)))
+
(define (parse-directory-component component)
(if (string=? ".." component)
'UP
component))
-\f
+
(define (string-components string delimiters)
(substring-components string 0 (string-length string) delimiters))
#| -*-Scheme-*-
-$Id: unxpth.scm,v 14.21 1996/02/27 21:53:14 cph Exp $
+$Id: unxpth.scm,v 14.22 1996/02/28 23:26:12 cph Exp $
Copyright (c) 1988-96 Massachusetts Institute of Technology
(simplify-directory
(if (string=? "" (car components))
(cons 'ABSOLUTE
- (map parse-directory-component
- (cdr components)))
+ (parse-directory-components
+ (cdr components)))
(cons 'RELATIVE
- (map parse-directory-component
- components))))))
+ (parse-directory-components
+ components))))))
name
type
'UNSPECIFIC))))))
false
directory))
+(define (parse-directory-components components)
+ (map parse-directory-component
+ (list-transform-negative components string-null?)))
+
(define (parse-directory-component component)
(if (string=? ".." component)
'UP