1
0
Fork 0

Don't let expanduser fail on absolute path

This commit is contained in:
Tom Willemsen 2012-09-16 15:31:30 +02:00
parent 8d15d4e7f9
commit bfed5ed044

View file

@ -102,8 +102,10 @@
(display #\'))))
(define (expanduser path)
(let ((parts (string-split path #\/)))
(if (eqv? (string-ref (car parts) 0) #\~)
(let* ((parts (string-split path #\/))
(part (car parts)))
(if (and (not (string-null? part))
(eqv? (string-ref part 0) #\~))
(let ((user (if (= (string-length (car parts)) 1)
(passwd:name (getpwuid (geteuid)))
(substring (car parts) 1))))