utils: file-name-components: Handle empty string.

* haunt/utils.scm (file-name-components): Return the empty list when
  given the empty string.
This commit is contained in:
David Thompson 2015-07-26 23:06:28 -04:00
parent 2f6b06dd22
commit 19a26608f2
1 changed files with 3 additions and 1 deletions

View File

@ -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."