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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,eda9cd0ad906c54b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!ecngs!feeder.ecngs.de!proxad.net!infeed-4.proxad.net!nnrp3-1.free.fr!not-for-mail Date: Wed, 14 Dec 2005 07:34:00 +0100 From: Lionel Draghi User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: fr-fr, en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How to get pathname of executable References: <4d4f4$439ee80e$49955ab$26123@ALLTEL.NET> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <439fbcd3$0$19908$626a54ce@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 14 Dec 2005 07:33:55 MET NNTP-Posting-Host: 82.236.216.140 X-Trace: 1134542035 nnrp3-1.free.fr 19908 82.236.216.140:52255 X-Complaints-To: abuse@proxad.net Xref: g2news1.google.com comp.lang.ada:6877 Date: 2005-12-14T07:33:55+01:00 List-Id: Dirk Heinrichs a �crit : > Marc A. Criley wrote: > > >>Dirk Heinrichs wrote: >> >>>I'm trying to find out how to get the complete pathname of an ada >>>executable on Linux. I already tried Ada.Command_Line.Command_Name, but >>>that only gives the executable's name as the user typed it. I want to >>>find out where it is stored in the filesystem so that it can load other >>>files from directories relative to its own directory. >> >>If you don't mind using vendor-supplied packages, and you're using GNAT, >>look at GNAT.OS_Lib.Normalize_Pathname(). Using this in combination with >>knowing what your current directory is, and/or >>GNAT.OS_Lib.Locate_Exec_On_Path() (if that might be needed), you can get >>that path. > If using vendor specifics is a problem, and if your compiler provides Ada 05 extensions, you may try: Ada.Directories.Full_Name (Ada.Command_Line.Command_Name) And if you're only interested in the directory: Ada.Directories.Containing_Directory (Ada.Command_Line.Command_Name) (Warning, I did not check this code) -- Lionel Draghi