From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,814d0ec938d6e4da X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-24 11:56:16 PST From: Egil Harald Hoevik Newsgroups: comp.lang.ada Subject: Re: How to find directory where the program is? Date: Wed, 24 Apr 2002 19:44:14 +0200 Organization: Kongsberg Defence & Aerospace Message-ID: <3CC6EEEE.6B2F1A20@kongsberg.com> References: NNTP-Posting-Host: 150.1.30.135 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.72 [en] (X11; I; SunOS 5.8 sun4u) X-Accept-Language: en Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!news.gtei.net!news-out.visi.com!hermes.visi.com!newspump.sol.net!easynet-tele!easynet-melon!easynet.net!uio.no!Norway.EU.net!193.71.169.73!spiten.kongsberg.com!kongsberg!not-for-mail Xref: archiver1.google.com comp.lang.ada:23073 Date: 2002-04-24T19:44:14+02:00 List-Id: Preben Randhol wrote: > > How can one in Ada95 find out from which directory the Ada program is > stored in. I mean I need to find out if my program is stored in > /usr/bin/ or /usr/local/bin or some other directory. Does anybody know > how I can do this. Note that current directory is not equal to the > directory the program is stored in. I use GNAT so if GNAT has some > routines for this that I have missed, please tell me. I'll make it > portable later if needed. > You can always take a look at the functions function Locate_Exec_On_Path (Exec_Name : String) return String_Access; and function Locate_Regular_File (File_Name : String; Path : String) return String_Access; in the package GNAT.OS_Lib ~egilhh -- "What I seek is to serve, with my feeble capacity, truth and justice at the risk of pleasing no-one." Albert Einstein.