From 19a26608f2739f3744b8dc7254e8cfe5d24d3867 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 26 Jul 2015 23:06:28 -0400 Subject: utils: file-name-components: Handle empty string. * haunt/utils.scm (file-name-components): Return the empty list when given the empty string. --- haunt/utils.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/haunt/utils.scm b/haunt/utils.scm index b69dab8..5fd97c7 100644 --- a/haunt/utils.scm +++ b/haunt/utils.scm @@ -67,7 +67,9 @@ flattened." (define (file-name-components file-name) "Split FILE-NAME into the components delimited by '/'." - (string-split file-name #\/)) + (if (string-null? file-name) + '() + (string-split file-name #\/))) (define (join-file-name-components components) "Join COMPONENTS into a file name string." -- cgit v1.2.3