>  On Fri, 25 Sep 2009, Alan G Isaac wrote:
> > I would like to change working directory dynamically in
> > a script, to the location of the script (*without* knowing
> > where that is). Is there an easy way (for students)?


On 9/25/2009 2:43 PM, Allin Cottrell wrote:
>  Offhand, no. But what are you actually trying to do, in the larger
>  scheme of things? There may be an easier way of doing it.


Students store data relative to the scripts.
E.g.,
         coursefolder
                 scripts
                 data
                 temp

Now gretl will search for data relative to the
script directory, so on Windows they can use

         open ..\data\mydata.gdt

But now suppose they try the obvious:

         store ..\temp\tempdata.gdt

This does not work, because store presumes
this is all relative to the working directory.
Students are often using lab computers with
network drives or flash drives, so it works
best if everything is relative to their
scripts directory.

Things are actually worse than this.  Suppose
they try

         store tempdata.gdt
         open tempdata.gdt

Now `store` will store this in the working directory,
but `open` will first look relative to the script,
so if there is also a `tempdata.gdt` in `classfolder`scripts`
they will open that by mistake!

Hope that's illustrative,
Alan


Reply via email to