[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: firstname.lastname@example.org
- Subject: packaging games
- From: Jason Stechschulte <email@example.com>
- Date: Sat, 23 Nov 2002 21:12:34 -0500
- Delivered-To: firstname.lastname@example.org
- Delivered-To: mailing list email@example.com
- Delivery-Date: Sat, 23 Nov 2002 21:12:54 -0500
- Mailing-List: contact firstname.lastname@example.org; run by ezmlm
- Reply-To: email@example.com
- Sender: Jason Stechschulte <firstname.lastname@example.org>
- User-Agent: Mutt/1.4i
This question really isn't a Linux game programming question, but rather
a Linux game packaging question. In the game I'm working on, I have a
data directory in which I place the graphics. In my code I have a line
const string DATADIR = "/usr/local/share/games/fred";
This works great when building from source. If you don't want the data
directory there, then just change that line before compiling. The
problem is that I don't really like hard-coding a path like that since
it does involve modifying the source code. Plus it would be nicer if it
wasn't that way for distributing binary copies of the game.
Is the best way to handle this to create a configuration file in /etc or
~/ and put the DATADIR path in that file?
If so, is there a library I can use to get the path that checks /etc
and ~/ automatically, or would I have to program that into my game
myself. It wouldn't be hard to add that in, but I'm wondering if there
is a standard way that already exists.
I was also thinking about not installing a configuration file, but still
check for it in my program. If it does exist, I can use that path and
if it doesn't exist, then I can use what I already have hard-coded.
The other thing I was wondering about is if it is possible to set this
as a compile time option somehow. Is there a way to put something in a
Makefile that can set this path so it gets compiled into the program
that way? That would be better than having it hard-coded in the program
If there is documentation out there describing what I am asking, please
just point me to the docs.
If you keep anything long enough, you can throw it away.