mes: Add basename.
* module/mes/posix.mes (basename): New function.
This commit is contained in:
parent
4dfe6e00cc
commit
b209378fca
|
@ -24,3 +24,10 @@
|
|||
|
||||
(define R_OK 0)
|
||||
(define S_IRWXU #o700)
|
||||
|
||||
(define (basename file-name . ext)
|
||||
(let ((base (last (string-split file-name #\/)))
|
||||
(ext (and (pair? ext) (car ext))))
|
||||
(if (and ext
|
||||
(string-suffix? ext base)) (string-drop-right base (string-length ext))
|
||||
base)))
|
||||
|
|
Loading…
Reference in a new issue