From: Chris Hanson Date: Tue, 11 Nov 1997 13:20:29 +0000 (+0000) Subject: Signal error when unable to determine user name or home directory. X-Git-Tag: 20090517-FFI~4936 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=75d0f5feca0356889aa85eacc4faaf6cfd234b20;p=mit-scheme.git Signal error when unable to determine user name or home directory. --- diff --git a/v7/src/runtime/ntprm.scm b/v7/src/runtime/ntprm.scm index 289494a84..8c6a4102d 100644 --- a/v7/src/runtime/ntprm.scm +++ b/v7/src/runtime/ntprm.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: ntprm.scm,v 1.13 1997/11/11 12:52:15 cph Exp $ +$Id: ntprm.scm,v 1.14 1997/11/11 13:20:21 cph Exp $ Copyright (c) 1992-97 Massachusetts Institute of Technology @@ -261,14 +261,14 @@ MIT in each case. |# (merge-pathnames user-name directory))))) (cond ((get-environment-variable "USERDIR") => (lambda (userdir) - (try (pathname-as-directory - (merge-pathnames userdir))))) + (try (pathname-as-directory (merge-pathnames userdir))))) ((nt/current-home-directory) => (lambda (homedir) (if (string=? user-name (current-user-name)) homedir (try (directory-pathname-as-file homedir))))) - (else (error "Unable to find user home directory:" user-name))))) + (else + (error "Can't find user's home directory:" user-name))))) (define (nt/current-home-directory) (let ((homedrive (get-environment-variable "HOMEDRIVE")) diff --git a/v7/src/runtime/os2prm.scm b/v7/src/runtime/os2prm.scm index 39744752f..7075fb3ca 100644 --- a/v7/src/runtime/os2prm.scm +++ b/v7/src/runtime/os2prm.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: os2prm.scm,v 1.32 1997/10/22 23:01:16 cph Exp $ +$Id: os2prm.scm,v 1.33 1997/11/11 13:20:29 cph Exp $ Copyright (c) 1994-97 Massachusetts Institute of Technology @@ -213,17 +213,22 @@ MIT in each case. |# (define (current-user-name) (or (get-environment-variable "USER") - "nouser")) + (error "Unable to determine current user name."))) (define (user-home-directory user-name) - (or (and user-name - (let ((directory (get-environment-variable "USERDIR"))) - (and directory - (pathname-as-directory - (pathname-new-name - (pathname-as-directory (merge-pathnames directory)) - user-name))))) - (merge-pathnames "\\"))) + (let ((try + (lambda (directory) + (pathname-as-directory (merge-pathnames user-name directory))))) + (cond ((get-environment-variable "USERDIR") + => (lambda (userdir) + (try (pathname-as-directory (merge-pathnames userdir))))) + ((get-environment-variable "HOME") + => (lambda (homedir) + (if (string=? user-name (current-user-name)) + homedir + (try (directory-pathname-as-file homedir))))) + (else + (error "Can't find user's home directory:" user-name))))) (define (dos/fs-drive-type pathname) (let ((type