summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--f.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/f.scm b/f.scm
index ffac4df..2f9cb83 100644
--- a/f.scm
+++ b/f.scm
@@ -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))))