summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-09-16 15:31:30 +0200
committerGravatar Tom Willemsen2012-09-16 15:31:30 +0200
commitbfed5ed044a751254448ed78009e8a8cdffe3270 (patch)
tree169336b770ef0c7ec782d144dc9d29466c225c53
parent8d15d4e7f9fe83f5de21f15c6848f0748b644bd2 (diff)
downloadtekuti-bfed5ed044a751254448ed78009e8a8cdffe3270.tar.gz
tekuti-bfed5ed044a751254448ed78009e8a8cdffe3270.zip
Don't let expanduser fail on absolute path
-rw-r--r--tekuti/util.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/tekuti/util.scm b/tekuti/util.scm
index e77d255..fe77c90 100644
--- a/tekuti/util.scm
+++ b/tekuti/util.scm
@@ -102,8 +102,10 @@
(display #\'))))
(define (expanduser path)
- (let ((parts (string-split path #\/)))
- (if (eqv? (string-ref (car parts) 0) #\~)
+ (let* ((parts (string-split path #\/))
+ (part (car parts)))
+ (if (and (not (string-null? part))
+ (eqv? (string-ref part 0) #\~))
(let ((user (if (= (string-length (car parts)) 1)
(passwd:name (getpwuid (geteuid)))
(substring (car parts) 1))))