diff options
-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} |