From 3ce5de87587bd46cdd3aa38543b019541428a286 Mon Sep 17 00:00:00 2001 From: mainzelm Date: Wed, 6 Feb 2002 15:17:19 +0000 Subject: [PATCH] If $HOME is unset, consult (user-info (user-uid)) for the value of home-directory. --- scsh/scsh.scm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scsh/scsh.scm b/scsh/scsh.scm index 35da464..49fe571 100644 --- a/scsh/scsh.scm +++ b/scsh/scsh.scm @@ -963,10 +963,20 @@ (define (init-scsh-vars quietly?) (set! home-directory - (cond ((getenv "HOME") => ensure-file-name-is-nondirectory) - (else (if (not quietly?) - (warn "Starting up with no home directory ($HOME).")) - "/"))) + (cond ((getenv "HOME") => ensure-file-name-is-nondirectory) + ;; loosing at this point would be really bad, so some + ;; paranoia comes in order + (else (call-with-current-continuation + (lambda (k) + (with-handler + (lambda (condition more) + (cond ((not quietly?) + (display "Starting up with no home directory ($HOME).") + (newline))) + (k "/")) + (lambda () + (user-info:home-dir (user-info (user-uid)))))))))) + (set-fluid! exec-path-list (cond ((getenv "PATH") => split-colon-list) (else (if (not quietly?)