(simple-file-perror "couldn't delete ~A" namestring err))))
t)
\f
+(defun ensure-trailing-slash (string)
+ (let ((last-char (char string (1- (length string)))))
+ (if (or (eql last-char #\/)
+ #!+win32
+ (eql last-char #\\))
+ string
+ (concatenate 'string string "/"))))
+
+(defun sbcl-homedir-pathname ()
+ (let ((sbcl-home (posix-getenv "SBCL_HOME")))
+ ;; SBCL_HOME isn't set for :EXECUTABLE T embedded cores
+ (when sbcl-home
+ (parse-native-namestring
+ (ensure-trailing-slash sbcl-home)))))
+
;;; (This is an ANSI Common Lisp function.)
(defun user-homedir-pathname (&optional host)
- "Return the home directory of the user as a pathname."
+ "Return the home directory of the user as a pathname. If the HOME
+environment variable has been specified, the directory it designates
+is returned; otherwise obtains the home directory from the operating
+system."
(declare (ignore host))
- #!-win32
- (pathname (sb!unix:uid-homedir (sb!unix:unix-getuid)))
- #!+win32
- (pathname (if (posix-getenv "HOME")
- (let* ((path (posix-getenv "HOME"))
- (last-char (char path (1- (length path)))))
- (if (or (char= last-char #\/)
- (char= last-char #\\))
- path
- (concatenate 'string path "/")))
- (sb!win32::get-folder-path 40)))) ;;SB-WIN32::CSIDL_PROFILE
+ (parse-native-namestring
+ (ensure-trailing-slash
+ (if (posix-getenv "HOME")
+ (posix-getenv "HOME")
+ #!-win32
+ (sb!unix:uid-homedir (sb!unix:unix-getuid))
+ #!+win32
+ ;; Needs to bypass PARSE-NATIVE-NAMESTRING & ENSURE-TRAILING-SLASH
+ (return-from user-homedir-pathname
+ (sb!win32::get-folder-pathname sb!win32::csidl_profile))))))
(defun file-write-date (file)
#!+sb-doc
:report "Continue as if directory creation was successful."
nil)))
(setf created-p t)))))
- (values pathname created-p))))
+ (values pathspec created-p))))
(/show0 "filesys.lisp 1000")