[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Call For Articles

Pierre Phaneuf <pp@ludusdesign.com> writes:

> Ingo Ruhnke wrote:

>> There is no other way to do this, if you have a look at question 1.14
>> in the Unix FAQ http://www.erlenstar.demon.co.uk/unix/faq_toc.html.
>> But you could of course override the hard coded path with one set by
>> an enviroment variable, an command line option or by an config file.
> Yes, I already knew that trying to find your binary so you can find the
> rest of the files isn't a good idea, but I was thinking of how I should
> present the interface to overriding the filenames.
> I'm not a big fan of environment variables for this task, but even if I
> use them, what variables should I listen (set the "prefix", set a
> directory that contains all the files, individual "redirections")?

It depends, if the game uses only static data, I would set the
variable to the data directory, so for example
GAME_DATADIR=/opt/GAME/share/GAME/, if it needs also shared libaries
etc. I would set it to the prefix.
> As for a config file, where should I put that? At my office for example,
> we have a NFS /opt (each machine type/architecture mount a specific
> /opt, of course), and I think that it would be rude to require that
> there be a configuration file in /etc...

Very difficult, you could place it in the homedir, but of course that
is only a workaround. The problem is that there is no standard place to
put it. You could of course put it under /opt/etc or so. and let
the game search there. But the problem is that, this is only a guess,
so the game checks if the datafiles are in the hardcoded pathes, if
they aren't check in different places (like /opt, /mnt, ore wherever
you want) and at the last step if it is still not found, exit with a
message that the user should set enviroment variable.
You could also check argv[0], if it is relative you can get the
directory using getcwd() + argv[0], but that still has side effects,
for example if the game installed under /mnt and linked to
/usr/local/bin, no datafiles are found. Then you could still resolve
the link and so on. 
I think an enviroment variable would cause much lesser throuble than
all this try and error searching.

Another way could be the creation of a shell script which olds the
path, for example something like:

GAME --set-path /where/ever/you/installed/the/stuff
This could be easily created with an install script and is maybe also
possible with rpm's and deb's.

BTW. How does Civ:CtP handle that? Does it only work in
     /usr/local/games/CivCTP (using symlink or being installed there)
     or is there some other way to tell CivCTP where it is installed? 
     Does it use videos or other data from the cdrom? Is it possible
     to run it directly from the cdrom (using symlinks or directly)?
                                  http://dark.x.dtu.dk/~grumbel/pingus/ | 
Ingo Ruhnke <grumbel@gmx.de>             http://home.pages.de/~grumbel/ |