[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Relative path in game?
- To: linuxgames@xxxxxxxxxx
- Subject: Relative path in game?
- From: Gianfranco Berardi <gberardi@xxxxxxxxxxx>
- Date: Thu, 12 Oct 2006 08:15:09 -0500
- Delivered-to: archiver@seul.org
- Delivered-to: mailing list linuxgames@sunsite.dk
- Delivery-date: Thu, 12 Oct 2006 09:15:46 -0400
- Mailing-list: contact linuxgames-help@sunsite.dk; run by ezmlm
- Reply-to: linuxgames@xxxxxxxxxx
- User-agent: Thunderbird 1.5.0.7 (X11/20060915)
Hello,
I just found that if I try to run the binary of my game from a different
directory, it can't find the files it is trying to load.
Now, my code is trying to open files as "../resources/fileName".
So, I figure I must be wrong in my code or my setup, but I am not sure
how to handle this problem. How do most games handle this issue?
I tried to change it to use "resources/fileName" and copying the binary
up one directory, but just as I suspected, it treats it as relative to
my current working directory.
How do I get my game to work with files relative to itself rather than
the user? This may seem like a simple problem, but other than creating
a shell script that has "cd gameDirectory; runGameApp", I'm not sure
what else to do, and the shell script seems kind of hacky.
Thank you in advance for your time,
Gianfranco
--
GBGames' Blog, An Indie Game Developer's Somewhat Interesting Thoughts:
http://www.gbgames.com/blog
Staff Reviewer for Game Tunnel, the Independent Underground:
http://www.gametunnel.com