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
1 changed files with 5 additions and 0 deletions

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))) "/"))))