[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: Relative path in game? SOLVED

On Fri, Oct 13, 2006 at 08:25:17AM -0500, Gianfranco Berardi wrote:

> I decided to look at the existing game installations I have.  It seems 
> that Sam Lantinga has already solved this problem years ago with his 
> FindPath() script:
> http://www.libsdl.org/pipermail/sdl/2001-March/034831.html

I wouldn't call FindPath() a solution, its a workaround that can easily
made to fail. When you for example extract a game to /opt/ and symlink the
binary to /usr/bin/ FindPath() will give you /usr/bin/ instead of /opt/ as
result. The correct way would be to read /proc/self/exe, binreloc from 
autopackage encupsules that and a bunch of other detection magic:


In general autopackage is a great way to find out how to solve all kinds
of problems with greating portable binaries under Linux.

PS: I would completly ignore all those Unix FAQs that tell you relocation
is a bad thing, since they assume source distribution and that the user
compiles himself, which however today is simply totally outdated,
especially for games. Old Unix FAQs are probally the worst advise if
you want to make your users life easier.

WWW:      http://pingus.seul.org/~grumbel/ 
Blog:     http://grumbel.blogspot.com/
JabberID: grumbel@xxxxxxxxxx 
ICQ:      59461927