Ethereal-dev: Re: [Ethereal-dev] Directory settings

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Sun, 29 Feb 2004 12:11:40 -0800
On Sun, Feb 29, 2004 at 07:57:21PM +0100, Ulf Lamping wrote:
> I currently find it very unintuitive, where Ethereal finds / uses all 
> it's directories. There is also no way to get information, what the 
> current settings are.
> 
> 
> Example: When I start a capture with the filename "hello.cap", I'm not 
> sure where the file will be placed into and "of course" there's no way 
> to change this :-(
> 
> Some places comes to my mind:
> 
> - working dir (this is the dir where "hello.cap" would be saved)

The working directory starts out as the directory in which Ethereal is
running.

If Ethereal is run from the command line, it'll run in that directory.

It appears that at least some UNIX desktops run Ethereal from your home
directory if you run it from a desktop/panel icon or a menu item.

If you run it from a desktop shortcut on Windows, and the desktop
shortcut has a "run it from this directory" setting, it'll be run from
that directory; I don't know what directory it's run in if that setting
is absent.  (I can try it on NT 4.0 at some point.)

The NSIS installer, unfortunately, doesn't appear to have a way not to
specify a "run it from this directory" setting in the shortcut it
creates; I recently changed ethereal.nsi to make a SetOutPath call to
set it to $PROFILE, which causes the user's "profile directory" to be
the "run it from this directory" setting - that directory is the
equivalent of the home directory on UNIX.

> - program dir (where the .exe is, or how it's called under unix)

I'm not sure it has an equivalent name on UNIX, but it's usually
something such as "/usr/bin" or "/usr/X11R6/bin" or "/usr/local/bin".

On UNIX, typically there's a top-level directory under which various
installation subdirectories exist, e.g. "/usr" if the executable is
installed in "/usr/bin" or "/usr/local" if it's installed in
"/usr/local/bin".

> - plugins dir (where the plugins will be searched for, includes version 
> string)

There are two plugin directories - the global one, and the per-user one.

The global one:

	it's just a subdirectory of the program directory on Windows -
	it's the "plugins\{plugin API version}" subdirectory, where
	"plugin API version" is currently the version number of
	Ethereal;

	on UNIX, if the top-level installation directory is X, it's the
	"X/lib/ethereal/plugins/{plugin API version}" directory.

The per-user one is just the "plugins" subdirectory if your personal
configuration directory.

> - persconf dir (where the personal config files will be placed, e.g. 
> personal colorfilters)

On UNIX, that's the ".ethereal" subdirectory of your home directory;
that follows a common UNIX convention.

On Windows, it's the "Ethereal" subdirectory of:

	the directory specified by the "APPDATA" environment variable,
	if that's set (on English-language Windows, that's probably
	something such as "C:\Documents and Settings\{user
	name}\Application Data");

	otherwise, the "Application Data" subdirectory of the directory
	specified by the "USERPROFILE" environment variable;

	otherwise, "C:\".

That's what some specification from Microsoft says (well, modulo the
fact that the path is supposed to be something such as "{vendor
name}\{application name}", or something such as that, but there's no
"Etherealcorp" (well, there's now an "Ethereal, Inc." that owns the
trademark on the Ethereal logo, but that's somewhat redundant -
"Ethereal\Ethereal" would be somewhat pointless).

"USERPROFILE" is, at least on NT (including NT 5.x, e.g. W2K, WXP, W2K3
Server), the user's "profile directory", which is typically

	x:\WINNT\Profiles\{user login name}

on NT 4.0, where "x:" is your root drive, and typically

	x:\Documents and Settings\{user login name}

on NT 5.0 (W2K, WXP, W2K3).

> - globalconf dir (where the global config files will be placed, e.g. 
> global colorfilters)

On UNIX, that's typically the "share/ethereal" subdirectory of the
top-level installation directory.

On Windows, that's the directory in which the Ethereal executable
resides.

> - tmp dir (where an "unamed" new capture file will be placed)

If the TMPDIR environment variable is set, that's what's used.

Otherwise, on Windows, if the TEMP environment varible is set, that's
what's used.

Otherwise, if P_tmpdir is defined at compile time, that's what's used;

Otherwise, "/var/tmp" is used.  (The assumption here is presumably that
TEMP is always set on Windows, typically to C:\TEMP or something such as
that).

> - file open dir (pref setting already available)
> 
> Just for a first start, I wanted to get a list of the possible dirs, 
> some of them might be duplicates.
> Do I miss something?
> 
> IMHO we need a new page "Directories" somewhere in Edit/Preferences...
> Most of the dirs are output only, some might be a new preference setting.
> 
> What do "the list" think?

I don't think having a preference setting specifying where the personal
preference settings are stored is likely to be useful.  :-) Besides,
that directory follows UNIX and Windows conventions.  The personal
plugins directory is just a subdirectory of that directory.

The program directory, plugins directory, and global configuration files
directory are all related, both on UNIX and Windows; they're all set at
installation time on Windows, and typically at build time on UNIX.  I
don't see any need to make them a configuration preference; anybody
who's going to be making *global* changes to Ethereal needs to know
where it's installed and can presumably figure out where it's installed.

The directory where the "Save As..." dialog box starts when saving a
capture file should perhaps be the file open directory - and the file
open directory should change if the user saves to some different
directory.  I suspect that's how it works with most other applications
on various GUIs.