[plt-scheme] changing current-directory in Dr Scheme?
Hi all -
How does (current-directory) actually work, specifically in Dr Scheme REPL?
I am trying to dynamically determine module's provided variables based on
Eli's code in
http://list.cs.brown.edu/pipermail/plt-scheme/2003-November/003698.html. It
works if the module path happens to be the current directory, but fails if
not, for modules that require another module "relatively".
Example:
; c:\data\scheme\lib\util\foo.scm
(module foo mzscheme
(define x 1)
(provide (all-defined)))
; c:\data\scheme\lib\util\util.scm
(module util mzscheme
(require "foo.scm")
(define y 2)
(provide (all-from "foo.scm"))
(provide (all-defined)))
Dr Scheme REPL
> (current-directory)
#<path:C:\Local\PLT>
> (parameterize ((current-directory "c:\\data\\scheme\\lib\\util\\"))
(expand (with-input-from-file "c:\\data\\scheme\\lib\\util\\util.scm"
read)))
Error: open-input-file: cannot open input file: "c:\Local\PLT\foo.scm" (The
system cannot find file specified.; errno=2)
This behavior is the same even when I attempt to modify REPL
current-directory first then expand the file. When I verify
(current-directory) it is indeed modified, but expand just simply doesn't
work from the changed directory - this is puzzling (I have also previously
run into another similar situation with a different function that I forgot,
so I don't think this is specifically due to (expand)).
> (current-directory "c:\\data\\scheme\\lib\\util\\")
> (current-directory)
#<path:c:\data\scheme\lib\util>
> (expand (with-input-from-file "c:\\data\\scheme\\lib\\util\\util.scm"
read))
Error: open-input-file: cannot open input file: "c:\Local\PLT\foo.scm" (The
system cannot find file specified.; errno=2)
How can I actually change the current-directory?
Thanks,
yinso
--
http://www.yinsochen.com
...continuous learning...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070423/621cd02a/attachment.html>