Re: Review of SRFI 170 through 3.2 I/O
Marc Feeley 23 Apr 2020 11:33 UTC
> On Apr 23, 2020, at 7:14 AM, Lassi Kortela <xxxxxx@lassi.io> wrote:
>
> Or did you mean specifically that setting the `working-directory` parameter should cause an error in case the directory does not exist, thereby matching the behavior of the chdir() syscall? That's a clever point that didn't occur to me. I guess it could use access() to check it, which is quite fast.
Gambit does what you suggest and also normalizes the path:
> (current-directory "/tmp")
> (current-directory)
"/private/tmp/"
> (current-directory "/does-not-exist")
*** ERROR IN ##make-parameter -- No such file or directory
(current-directory "/does-not-exist")
This behaviour is useful in the case where the existence of a directory must be guaranteed. So this code:
(parameterize ((current-directory <dir>))
…access files in the directory…)
will raise an error when the CWD is changed, not when the first file is accessed.
Marc