From: Taylor R Campbell Date: Sun, 6 Apr 2014 22:08:53 +0000 (+0000) Subject: Make (cd "/nonexistent") fail. X-Git-Tag: release-9.2.0~23 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=1dda7521fc9b5e89f69d7c50e449cf6ce5041980;p=mit-scheme.git Make (cd "/nonexistent") fail. Kinda kludgey, but it'll do for interactive use. See XXX comment for what a proper solution should look like. --- diff --git a/src/runtime/wrkdir.scm b/src/runtime/wrkdir.scm index 5cfa2bbdb..35c437521 100644 --- a/src/runtime/wrkdir.scm +++ b/src/runtime/wrkdir.scm @@ -49,6 +49,20 @@ USA. (define (set-working-directory-pathname! name) (let ((pathname (new-pathname name))) + ;; XXX Checking FILE-DIRECTORY? is a stop-gap kludge until we fix + ;; the concept of `working directory' by (a) making it be the + ;; directory, not the pathname; (b) making it thread-local, and (c) + ;; opening it in SET-WORKING-DIRECTORY! and hanging onto it for + ;; relative lookups, either by changing directory just before each + ;; lookup or using relative lookup system calls. + (if (not (file-directory? pathname)) + (error:file-operation name "enter" "directory" + (if (file-exists? + (directory-pathname-as-file pathname)) + "not a directory" + "no such directory") + 'SET-WORKING-DIRECTORY-PATHNAME! + (list name))) (set! *working-directory-pathname* pathname) (set! *default-pathname-defaults* pathname) (cmdl/set-default-directory (nearest-cmdl) pathname)