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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no 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!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Wed, 14 Dec 2005 18:02:32 -0600 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <4d4f4$439ee80e$49955ab$26123@ALLTEL.NET> <439fbcd3$0$19908$626a54ce@news.free.fr> Subject: Re: How to get pathname of executable Date: Wed, 14 Dec 2005 18:06:52 -0600 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4952.2800 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-I3njwj5uCAdNKIVQ2zQgf+/fIunj4YJprxecom42oygmT3lPV2tZMbkzSwS5eb8YT7V4CiKm8Sg+dLe!uq9DZNs5Czs5WVOjPwDvIkj+Qm7SbJLoNJ+HaZ1UsvkcjXL5XDhinI3tjYlSYTAr6vnuMd8xWKNg!P3uwGTuiOMv+1g== X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:6881 Date: 2005-12-14T18:06:52-06:00 List-Id: "Lionel Draghi" wrote in message news:439fbcd3$0$19908$626a54ce@news.free.fr... > 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 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) And if you want the full name of the directory, you need to use both: Ada.Directories.Full_Name (Ada.Directories.Containing_Directory (Ada.Command_Line.Command_Name)) If your compiler supports this new package, it's recommended to use it rather than implemented-defined packages, simply because it will make your code more portable in the long run, and no less portable in the short run (if some other compiler doesn't support Ada.Directories, then you might have to change the code, but that other compiler is rather unlikely to support GNAT-specific packages anyway, so this is no worse and likely better). Randy.