New BinReloc patch

Arend van Beelen jr. arend at auton.nl
Sun Apr 18 19:09:14 BST 2004


On Sunday 18 April 2004 19:48, David Faure wrote:
> On Sunday 18 April 2004 19:35, Arend van Beelen jr. wrote:
> > Hi!
> >
> > Been a bit busy last few days, but I've created a new (significantly
> > reduced) patch for adding binary relocation support to KStandardDirs.
> > There are now two new API calls: executablePrefix() and libraryPrefix().
> > The first function will always return the prefix where the current
> > executable is installed
>
> Why does executablePrefix() use a linux-only (/proc) method for finding the
> full path to the current executable? Isn't there a way that works
> everywhere, like using argv[0], resolved to $PWD if relative?
The argv[0] method won't work for apps that are called through the path. Also 
$PWD is not always the path with the binary in it. So, there isn't really a 
portable way of it doing it. To make it worse, Solaris apparently doesn't 
even provide the functionality at all. So, indeed, it will only work on Linux 
and for other platforms the function will return QString::null. Basically 
that means that binaries compiled on those platforms will still not be 
relocatable (just as they aren't now). As Thiago suggested, I can #ifdef the 
logic of the function out, making it immediately return QString::null on 
non-Linux platforms.

> I guess libraryPrefix() cannot be "ported" so easily - but OTOH nothing in
> your patch seems to be using it...
True, I don't use it yet. It's just there for libraries that might want to use 
it. It would be required for any KDE library that has to be able to find its 
data files even if installed outside the regular KDE dirs.

-- 
Arend van Beelen jr.
http://www.liacs.nl/~dvbeelen

Yes, he died, but he will return to die with me again.
-- Nightwish




More information about the kde-core-devel mailing list