diff options
-rw-r--r-- | f.scm | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -33,6 +33,7 @@ delete traverse copy + extension no-extension replace-extension) #:re-export (chown @@ -173,6 +174,14 @@ appending a #t at the end.")))))) by appending a #t at the end.")))) (copy-file src dest))) +(define (extension file) + "Return extension for FILE." + (let ((ext (string-match ".+\\.(.*)" (basename file)))) + (cond + ((string-null? file) #f) + (ext (regexp-substitute #f ext 1)) + (else "")))) + (define (no-extension file) "Return FILE path without extension." (let ((without-ext (string-match "(.+)\\..*" (basename file)))) |