diff options
author | Gary Houston <ghouston@arglist.com> | 2000-05-14 22:15:13 +0000 |
---|---|---|
committer | Gary Houston <ghouston@arglist.com> | 2000-05-14 22:15:13 +0000 |
commit | 1f08acd9eef40805840d17e61ecfc4b4658f8fe1 (patch) | |
tree | 5147fe2dbe2bd28a3d6566654fbbbefab7024934 | |
parent | 07ccd85d6a8820cf6590915267d8588504135dae (diff) | |
download | guile-1f08acd9eef40805840d17e61ecfc4b4658f8fe1.tar.gz |
2000-05-14 Gary Houston <ghouston@arglist.com>
* boot-9.scm (load-user-init): rewritten. first work out the home
directory and then try to open the file (previously it could try
to open a file in more than one place). catch exceptions when
trying to get a directory from the user database. don't check
that ~/.guile is not a directory before trying to load it (a lack
of ~/.guile is not a crime, but if the file is not valid for any
reason then primitive-load will raise an error).
-rw-r--r-- | ice-9/boot-9.scm | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/ice-9/boot-9.scm b/ice-9/boot-9.scm index 034e1a883..1157c7b6f 100644 --- a/ice-9/boot-9.scm +++ b/ice-9/boot-9.scm @@ -749,16 +749,12 @@ ;; This is mostly for the internal use of the code generated by ;; scm_compile_shell_switches. (define (load-user-init) - (define (existing-file dir) - (let ((path (in-vicinity dir ".guile"))) - (if (and (file-exists? path) - (not (file-is-directory? path))) - path - #f))) - (let ((path (or (existing-file (or (getenv "HOME") "/")) - (and (provided? 'posix) - (existing-file (passwd:dir (getpw (getuid)))))))) - (if path (primitive-load path)))) + (let* ((home (or (getenv "HOME") + (false-if-exception (passwd:dir (getpwuid (getuid)))) + "/")) ;; fallback for cygwin etc. + (init-file (in-vicinity home ".guile"))) + (if (file-exists? init-file) + (primitive-load init-file)))) ;;; {Loading by paths} |