Lapas

Friday 2 November 2012

Lotus Notes. Getting user HOME on MACINTOSH

I had run in problem building application for MACINTOSH in LN. It was required to install some user files for regular use and it should be installed in user home directory. So then problem was, that Lotusscript does not gives user home directory location using Environ, or NotesSession.getEnvironmentString.
First my attempt were to execute shell like "env > /tmp/userenv.txt" and then read the file, parse and get HOME directory from file - I don't like this, because You need to create a file on disk.
Second attempt were to search for dll containing standard C function getenv, which must return environment variable by specified name. So the library found is "libSystem.dylib" and resulting declaration in LS library, agent {Declare Function mac_getenv  Lib "libSystem.dylib" Alias "getenv" (ByVal varnameAs String) As String}, so call mac_getenv("HOME") and voila!


No comments:

Post a Comment