Hi all -<br><br>How does (current-directory) actually work, specifically in Dr Scheme REPL? <br><br>I am trying to dynamically determine module's provided variables based on Eli's code in <a href="http://list.cs.brown.edu/pipermail/plt-scheme/2003-November/003698.html">
http://list.cs.brown.edu/pipermail/plt-scheme/2003-November/003698.html</a>. It works if the module path happens to be the current directory, but fails if not, for modules that require another module "relatively".
<br><br>Example:<br><br>; c:\data\scheme\lib\util\foo.scm<br>(module foo mzscheme <br> (define x 1)<br> (provide (all-defined))) <br><br>; c:\data\scheme\lib\util\util.scm<br>(module util mzscheme <br> (require "foo.scm
")<br> (define y 2) <br> (provide (all-from "foo.scm")) <br> (provide (all-defined))) <br><br>Dr Scheme REPL <br>> (current-directory)<br>#<path:C:\Local\PLT><br>> (parameterize ((current-directory "c:\\data\\scheme\\lib\\util\\"))
<br> (expand (with-input-from-file "c:\\data\\scheme\\lib\\util\\util.scm" read))) <br>Error: open-input-file: cannot open input file: "c:\Local\PLT\foo.scm" (The system cannot find file specified.; errno=2)
<br><br>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)).
<br><br>> (current-directory "c:\\data\\scheme\\lib\\util\\")<br>> (current-directory)<br>#<path:c:\data\scheme\lib\util><br>> (expand (with-input-from-file "c:\\data\\scheme\\lib\\util\\util.scm" read))
<br>
Error: open-input-file: cannot open input file: "c:\Local\PLT\foo.scm" (The system cannot find file specified.; errno=2) <br>
<br>How can I actually change the current-directory? <br><br>Thanks,<br>yinso <br><br>-- <br><a href="http://www.yinsochen.com">http://www.yinsochen.com</a><br>...continuous learning...