[Gretl-devel] directory structure in CVS

Allin Cottrell cottrell at wfu.edu
Fri Dec 28 22:53:20 EST 2007


I've taken a first step in modifying the gretl directory 
structure, in CVS and the current Windows snapshot, following the 
discussions here a few days back.

I've split the old "userdir", which served both as the repository 
for automatically generated files and as the default location for 
explicit file input/output on the user's part, into two:

(a) "dotdir": this holds the automatic files.  It is not 
user-selectable (directories of this sort are rarely if ever 
user-configurable).  On unix-type systems it is HOME/.gretl, and 
on MS Windows it is APPDATA\gretl, where "APPDATA" is a standard 
Windows API thing, localized and user-ized.  It may expand to 
something like

"C:\Documents and Settings\cottrell\Application data"

(b) "workdir": the default path for explicit user file I/O. This 
defaults to HOME/gretl on unix, and to PERSONAL\gretl on Windows.  
"PERSONAL" is again localized and user-ized.  It may expand to 
something like

"C:\Documents and Settings\cottrell\My Documents"

Unlike dotdir, this is user-configurable.  For previous gretl 
installations, it inherits the old "userdir" setting; for new 
installs it can be changed under Tools/Preferences, as before.

I considered using just HOME (unix) or PERSONAL (Windows) for the 
default workdir (without appending "/gretl").  But gretl writes 
some files to this directory without explicit GUI filename 
selection (e.g. the eqnprint and tabprint commands, the gnuplot 
command in batch mode), and it seemed like bad form to dump stuff 
into HOME or PERSONAL directly.  If you don't want to use
{HOME,PERSONAL}/gretl for this purpose, change the preference and 
blow the unneeded directory away.

A couple of other changes:

(1) The Windows installer no longer prompts for, or creates, a 
per-user working directory.  This is handled at run-time: the 
appropriate "dotdir" and default "workdir" are created for the 
current user, if they don't already exist (and if the default 
workdir is not contradicted by an existing registry setting).

(2) Since the CWD (current working directory) is pretty much 
inscrutable on Windows, we no longer use this as the default 
for the "shelldir" variable: this now defaults to the "workdir".
(You can launch GUI program from a Windows console, but I don't 
think anyone but me ever does that!)

Since (a) OS X is very much GUI-oriented and (b) gretl from the OS 
X dmg starts up inside Gretl.app, which is definitely not a 
sensible location for writing anything, I've also arranged for 
shelldir to default to workdir on OS X.  

On unix, the shelldir still defaults to whatever is the CWD on 
startup.  This could perhaps be user-configurable (CWD vs. 
workdir), but it would be a somewhat arcane item.

As I say, this is a first step.  I have not yet done anything 
about automatically changing workdir based on the last directory 
visited via the file open/save dialog.  I'm not sure that's a good 
idea, though it's open for discussion.

Allin.


More information about the Gretl-devel mailing list