From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Mon May 25 2009 - 09:52:04 CDT

On Sun, 2009-05-24 at 20:39 -0700, Rob wrote:
>
> Hello,

rob,

> I'm using 1.8.7beta3 and the plugin stuff from CVS.
>
> I'm working on a new plugin and I encounter a problem with the settings
> for the filename extension. It's not as flexible as it appears to be....

happens.

> I need to load files like "foobar_GEO" created by ABINIT.
> Hence, I want the file selector to be able to show me the list of "*_GEO" files.
> However, this is not possible.
>
> If I use "_GEO" as an entry for the filename extension in the plugin,
> I get the list of "*._GEO" (notice the added asterisk and dot to the string).
> This is not what I want!

sorry, but this is a convention used across the vast majority of
operating systems that i have come across in almost 30 years (and
there were quite a few). the filename _extension_ is what is
following the dot (some OSes had version numbers on top of that,
which were separated by a semicolon). what you are describing would
be a _pattern_ (a globbing pattern to be accurate).

> Why are the "dot" and asterisk automagically added?

as per convention. have a close look at how file browsers
are programmed, e.g. tk_getOpenFile (which is used in may VMD
plugins and can also be used from the main menu via setting the
environment variable VMDFILECHOOSER to the value of TK. tk_getOpenFile
has a section explaining how extensions are handled and on some
operating systems - e.g. linux -, they are actually converted
to glob patterns (with a leading '*' though). now in principle
the VMD code could be changed to do glob matching on unix-oid
operating systems, but that would break on, e.g., windows.

> Why not leave that up to the programmer of the plugin to add it to the
> filename extension settings, if necessary?

> It'll then even be possible to add the asterisk in the middle or end of the
> filename. This would make the filename extension field so much more useful.

but it would break very many tools that split filenames into
root and extension by using the dot, or worse it will not work
at all on operating systems where the extension is part of how
filenames are stored in the filesystem and where the dot by itself
actually does not appear in the physical filename (on FAT style
file systems, for example).

> This is very annoying.

well, you could just as easily complain to the abinit developers that
they don't stick to conventions that most other codes adhere to.

> Any possibilities to change this filename extension behavior before official release?

this is not for me to decide, but i doubt it, as it would have
serious portability implications and may break existing plugins.
being used on many platforms forces packages like VMD frequently
to stick to the lowest common denominator solutions.

> ---------------
>
> A possible bug in the plugin filename extension is following:
>
> The documentation says:
> (http://www.ks.uiuc.edu/Research/vmd/plugins/doxygen/structmolfile__plugin__t.html)
>
> "...list them in a comma separated list..."
>
> But when I use a comma-separated extension list, the result is that only the first one
> appears in the "Show" field of the file selector !
> I presume this is a bug, either in the plugin or in the documentation.

well, the corresponding code in the main VMD source code is commented
out with a remark, that the current file browser code has problems
with multiple extensions.

axel.

> Also:
> I discovered that I can replace the comma by a bar |,
> but this does yet do something else.....
>
>
> Rob.
>
>
>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.