summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinglu Chen <public@yoctocell.xyz>2021-03-03 14:55:16 +0100
committerAlexandru-Sergiu <brown121407@posteo.ro>2021-03-03 21:59:00 +0200
commit63736afc46cad652bee949fe3911d2be6a272fec (patch)
tree83bb52807d6eda61e16f6bd98795dace689cd84c
parent965e86688df29ba68ba3c68f16d33fa5cc5f1f3a (diff)
Add extension.HEADmaster
* f.scm (extension): New procedure.
-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))))