[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Undesired behaviour of current-directory parameter



Quoting Hannu Koivisto:
> It seems that current-directory parameter works so that setting the
> parameter doesn't actually change process' current directory
> immediately but it is changed when one, for example, runs an
> external application. 

True. The reason is that `current-directory' is thread-specific, but
Windows's working directory is process-specific.

> This seems to fall apart in the following
> situation:
> 
> (define temp-dir "some-directory-that-does-not-exist-yet")
> (make-directory temp-dir)
> (parameterize ((current-directory temp-dir))
>   (system* ...))
> (delete-directory temp-dir)
>
> What happens is that delete-directory fails because mzscheme
> process is using the directory that is being deleted.

Yep.

> Perhaps delete-directory should be modified to set process' current
> directory from the corresponding parameter or the whole method
> should be changed so that the current directory of the process is
> changed immediately when the parameter is set?

That sounds like a good idea.

I don't suppose anyone can think of other OS-level operations that are
sensitive to the current directory setting? (I would never have thought
of `delete-directory'.)

Matthew