X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ffilesys.lisp;h=c10aabcc2e58b791a40e627899691ce98eb0719a;hb=1975bd0492ed33de669f92d8c03d75bca19ed011;hp=960cf4e385f7d1e0330dbd22357b23b74c2edaed;hpb=772e2f4f22a7034fc6f9101d9f088163a0d32e77;p=sbcl.git diff --git a/src/code/filesys.lisp b/src/code/filesys.lisp index 960cf4e..c10aabc 100644 --- a/src/code/filesys.lisp +++ b/src/code/filesys.lisp @@ -584,13 +584,21 @@ exist or if is a file or a symbolic link." :as-directory t)))) (defun user-homedir-namestring (&optional username) - (if username - (sb!unix:user-homedir username) - (let ((env-home (posix-getenv "HOME"))) - (if (and env-home (not (string= env-home ""))) - env-home + (flet ((not-empty (x) + (and (not (equal x "")) x))) + (if username + (sb!unix:user-homedir username) + (or (not-empty (posix-getenv "HOME")) + #!+win32 + (not-empty (posix-getenv "USERPROFILE")) + #!+win32 + (let ((drive (not-empty (posix-getenv "HOMEDRIVE"))) + (path (not-empty (posix-getenv "HOMEPATH")))) + (and drive path + (concatenate 'string drive path))) #!-win32 - (sb!unix:uid-homedir (sb!unix:unix-getuid)))))) + (not-empty (sb!unix:uid-homedir (sb!unix:unix-getuid))) + (error "Couldn't find home directory."))))) ;;; (This is an ANSI Common Lisp function.) (defun user-homedir-pathname (&optional host)