I found it useful to generalize .local
Michael Thayer
michael.thayer at oracle.com
Mon Apr 11 06:26:09 PDT 2011
On Mon, 2011-04-11 at 12:08 +0200, Damjan Jovanovic wrote:
> Most *nix applications hardcode their installation prefix at compile
> time, so you'd have to have exactly the same $HOME as the account
> under which an RPM was compiled for that to work.
>
> This is not an issue that can really be fixed portably: argv[0] is
> unreliable, POSIX has no API like GetModuleHandle() and
> GetModulePath() on Windows, /proc/self/exe is Linux-only and can only
> be used for application, while searching the lines in /proc/self/maps
> for an internal symbol is the only method available to a library to
> discover its own path, only works on Linux, and is obscure and unknown
> to the vast majority of developers.
Convention says that argv[0] should point to the executable. If you are
going to modify an application anyway to support runtime prefix
discovery why not just make that a requirement (maybe with a default
path as a fallback) and let it be the caller's problem if they don't set
argv[0] as they should. (Let's not discuss setuid here!)
Regards,
Michael
--
ORACLE Deutschland B.V. & Co. KG Michael Thayer
Werkstrasse 24 VirtualBox engineering
71384 Weinstadt, Germany mailto:michael.thayer at oracle.com
Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603
Komplementärin: ORACLE Deutschland Verwaltung B.V.
Rijnzathe 6, 3454PV De Meern, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven
More information about the xdg
mailing list