[gtkada] configuration files

Stephen Leake stephen_leake at acm.org
Wed May 29 02:11:52 CEST 2002


Jacob Sparre Andersen <sparre at nbi.dk> writes:

> Stephen Leake wrote:
> 
> > For the same reason, I would like to not use "dot files"
> > on Unix. These are not "personal preferences", they are
> > "application settings". They should be bound to the
> > application, not the user.
> 
> "dot files" are certainly intended for storing personal
> preferences!

Yes, which I said I don't want. 

Certainly this package should support use for personal preferences. I
would also like to be able to specify an arbitary file name, and treat
it as a config file.

> > Let's take the Windex Profiles API as a starting point:
> > 
> > http://users.erols.com/leakstan/Stephe/Ada/Windex_Packages/index.htm
> > 
> > file windex-profiles.ads
> 
> It looks reasonable execept for a few details:
> 
>  * I would like to have the option of reading the settings
>    from a prioritised list of configuration files, and not
>    just a single named file.

Yes, that would be good. It is actually implemented in the Windows
code, but my comments don't say so.

We need some means of specifing a search path, and/or a list of
default file names.

>  * The above mentioned prioritised list of configuration files
>  should be initialised according to the conventions of the operating
>  system used.

By default, yes. User should be able to override.

>  * It would be practical to include a function for reading the
>  configuration file(s) into a suitable data structure, so the files
>  only need to be read once during the execution of a program.

I'm assuming that is how the body will be implemented. Are you saying
you want that visible to the client?

Although, that raises the issue of sharing config files among more
than one instance of a program. I believe the Windows implementation
maps the ini file to memory, and shares that mapping among processes,
at least for the system-wide Windows/win.ini.

> > It would be nice to have a standard file syntax, as well as a
> > standard API, so I can bundle a default or example profile file
> > with an app, and it would work for any OS.
> 
> Yes. Both the syntax used in "ini files" and the syntax
> sketched for some Java configuration files seems reasonable
> to me. Should we go for the "ini files"?

"ini files" have only one layer of hierarchy; sections and keys. the
Java style supports arbitrarily many layers (although we probably want
to set some max line length), and therefore more flexible. So if we
are writing this from scratch, I'd go with the Java style. I think it
is more like the X windows config files, as well. 

Hmm, maybe there's already some code in the X sources we can use?

-- 
-- Stephe





More information about the gtkada mailing list