Am 21.12.2007 23:27, Allin Cottrell schrieb:
On Sat, 15 Dec 2007, Sven Schreiber wrote:
> And last but not least: the cwd seems to be very fragile,
> especially on windows
>
Could you give an example of what you mean by fragility?
Well, you said it yourself some time ago when you were hunting a bug
that I had reported with respect to saved file locations. Apparently
many actions on windows implicitly change the CWD, making it's use in
scripts quite unpredictable.
Further question from Sven:
> have I understood correctly that it is not possible to reference
> from a script another file which is in the same directory? (of
> course unless that directory is also the userdir or similar, and
> unless the directory's name is hardcoded into the script)
>
Do you mean, that if a script references another file given as a
plain (non-dot) relative path, gretl will look for the latter in
the same place the script was found? If so, this is the case for
open/append and run/include. For example, if I do
gretlcli -b /some/odd/place/foo.inp
and foo.inp says "open baz.gdt", then we try looking for baz.gdt
in /some/odd/place. There's an internal variable "currdir" which
is set/reset each time a script is opened, and this directory is
prepended to the search path.
Hm, ok, though my question arises from experiences where I thought that
wouldn't work. I'll report it as a bug eventually when I come across
something reproducible and clearcut.
In general I must say I'm not really happy with gretl's concept of the
user dir. Personally I prefer to arrange my files in terms of projects
I'm working on, not in terms of applications that created those files. I
mean that information is already given by the file extension or other
metadata. So I guess I would like it if gretl had a third preference
option where to open or save files, and that would be in the dir of the
current datafile, or alternatively simply in the last dir which was
used, similar to the "currdir" thing you just mentioned (but which
should be updated not only by handling scripts). Actually until a while
ago I used to think that that was meant by "current working dir" because
to me it sounded very much like it.
(Another loosely related issue about the user dir: when installing
gretl, you are asked for its location. But on windows gretl must be
installed as admin, and presumably that will not be the user account
that executes gretl afterwards. So it doesn't make much sense to ask for
it at install time.)
Thanks for the explanations,
Sven