mes: Add dirname.

* module/mes/guile.mes (dirname): New function.
This commit is contained in:
Jan Nieuwenhuizen 2018-01-01 16:40:23 +01:00
parent 08562b168d
commit 244d11a2af

View file

@ -149,3 +149,8 @@
(set! set-current-input-port save-set-current-input-port)
string-port)))))))
string-port)))
(define (dirname file-name)
(let ((lst (filter (negate string-null?) (string-split file-name #\/))))
(if (<= (length lst) 1) "."
(string-join (list-head lst (1- (length lst))) "/"))))