isak.savo at gmail.com
Fri Sep 21 03:24:52 PDT 2007
2007/9/21, Alexander Larsson <alexl at redhat.com>:
> On Thu, 2007-09-20 at 12:41 +0200, Mildred wrote:
> > Le Thu 20/09/2007 à 09:28 Alexander Larsson à écrit:
> > > Also, most apps are not relocatable, so it will be hard to package
> > > them like this.
> > For me, an app that is not relocatable is bogus. Just change it to make
> > it relocatable.
> Its easy to state such an opinion. However, to actually make all apps
> relocatable is more work.
It's actually not that hard. The problem is that there isn't any
portable way of doing this for all platforms. On Linux, you can get
the full path of the current process by looking inside /proc/
filesystem (which is what binreloc from autopackage does). Windows
has native API for it. OSX probably too (not sure). No idea on how to
do it on bsd for instance.
Once you have the full path to the currently executing binary, it's
just a matter of replacing hardcoded DATADIR etc with a runtime
initialized variable or function call.
There's also methods that require no changes to the original source code.
More information about the xdg