TIP: Click on subject to list as thread! ANSI
echo: pascal
to: ALL
from: `Jasen Betts`
date: 1999-03-11 00:00:00
subject: FPC/Linux

SH> Under FPC/Linux, does anybody know how to get the directory the program
SH> binary file resides in?

SH>   S := ParamStr(0);

under dos that function isn't guaranteed to give an exact answer....
sometimes you'll get a relative answer... eg: '..\'

For Iinux, paramstr(0) will be without a directory unless one was specified on
the command-line. (and and that could point to a link and not the actual
file...)

Anyway why do you need this feature?  libraries go in /lib... global config
files in /etc and personal ones in ~ (these ones usually have filenames
starting with '.')  if you need a place to stick some text files you could
make a subdirectory of /etc, or put it in the config file in /etc ...

If you really have to know where the executable is you could take check
paramstr(0) for a dirtectory and if that fails try searching through all the
directories in getenv('PATH') for files called prarmstr(0) that are
executable by the user, there may be some procedures/functions that make this
easy...
/======================================================================
| Orange County Usenet  Fidonet gateway                              
|                                                                      
| User email address:   Jasen.Betts.noemail@webworldinc.com                                             
| FTN email: Jasen Betts[RemoveThis]@f350.n640.z3.fidonet.org
| User FidoNet address: 3:640/350                                             
| Report abuse of this service to joejared@webworldinc.com

SOURCE: alt.fidonet via archive.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.