mes: dirname: Fix for absolute file names.
* mes/module/mes/guile.mes (dirname): Fix absolute files.
This commit is contained in:
parent
ef78835501
commit
fec9fde0c9
|
@ -99,9 +99,13 @@
|
||||||
port))
|
port))
|
||||||
|
|
||||||
(define (dirname file-name)
|
(define (dirname file-name)
|
||||||
(let ((lst (filter (negate string-null?) (string-split file-name #\/))))
|
(let* ((lst (string-split file-name #\/))
|
||||||
(if (<= (length lst) 1) "."
|
(lst (filter (negate string-null?) lst)))
|
||||||
(string-join (list-head lst (1- (length lst))) "/"))))
|
(if (null? lst) (if (string-prefix? "/" file-name) "/" ".")
|
||||||
|
(let ((dir (string-join (list-head lst (1- (length lst))) "/")))
|
||||||
|
(if (string-prefix? "/" file-name) (string-append "/" dir)
|
||||||
|
(if (string-null? dir) "."
|
||||||
|
dir))))))
|
||||||
|
|
||||||
;; FIXME: c&p from display
|
;; FIXME: c&p from display
|
||||||
(define (with-output-to-string thunk)
|
(define (with-output-to-string thunk)
|
||||||
|
|
Loading…
Reference in New Issue