From 1dda7521fc9b5e89f69d7c50e449cf6ce5041980 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 6 Apr 2014 22:08:53 +0000 Subject: [PATCH] Make (cd "/nonexistent") fail. Kinda kludgey, but it'll do for interactive use. See XXX comment for what a proper solution should look like. --- src/runtime/wrkdir.scm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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) -- 2.25.1