Sorry for raising this maybe slightly off-topic remark, but since I've seen something along the lines of
GetEnvironmentVariable('HOME')
to determine a user's home directory on GNU/Linux and other UNIX-like OSes quite often, I would like to remind everyone that it's not a given this environment variable exists or is set to the proper value. Most interactive shell sessions will have it set, but not all commonly encountered (and even less so, all possible) execution environments will have it. Even
getuserdir seems to get it wrong, at least per its docs, and if you call it with an empty HOME value in the env, it will return "/tmp", which is its own can of worms entirely.
Only
getpwnam(3) or getpwuid(3) from the host's C library will
always yield the right thing (even in the face of more exotic circumstances, like the user database not living in /etc/passwd due to nsswitch, for example), which is what you should call from any fpc code to get this right. Unfortunately, it escapes me how to do that, since the only reference I could find is to the deprecated libc stuff in
https://www.freepascal.org/daily/packages/libc/index-8.html#SECTIONG - but if anyone else can chime in, I'd be eager to learn!