[Proj] Finding PROJ_LIB from application
Roger.Bivand at nhh.no
Thu Jan 15 15:55:29 EST 2009
On Thu, 15 Jan 2009, Glynn Clements wrote:
> Roger Bivand wrote:
>> Is there any way to query the system for the path to lib - effectively the
>> path value in sysname in pj_open_lib.c, line 184? From inside R, I'd like
>> to be able to show which path is being used.
> There doesn't appear to be any explicit support for this, but there
> are a couple of hacks available if "don't know" isn't fatal:
> 1. Set PROJ_DEBUG, (temporarily) point stderr at a file, and parse the
> filename out of the debug message (which could contain other text if
> library functions or the finder function write to stderr).
> 2. Make a copy of pj_open_lib() which returns the path rather than
> opening it, call fstat(fileno(fp)) and stat(pathname), and check that
> the dev/inode match.
> 3. On Linux, use fileno() to get a descriptor from the returned FILE*
> and look up the filename in /proc/self/fd/<fd>. Some other Unices
> support /proc, but I don't know how consistent they are.
> 4. On Windows, GetFinalPathNameByHandle(_get_osfhandle(_fileno(fp))).
Thanks. For now, I've backed off until users require the path displayed -
I need to check out the OSX PPC endian issue first.
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the Proj