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,b97aa4480eccc494 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news.glorb.com!uio.no!fi.sn.net!newsfeed1.fi.sn.net!news.song.fi!not-for-mail Date: Tue, 24 Jul 2007 14:44:16 +0300 From: Niklas Holsti User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20060628 Debian/1.7.8-1sarge7.1 X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How to get the application path References: <46a456aa$0$25908$426a34cc@news.free.fr> <1185204459.328520.240930@z24g2000prh.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <46a5e4e1$0$27850$39db0f71@news.song.fi> Organization: TDC Song Internet Services NNTP-Posting-Host: laku61.adsl.netsonic.fi X-Trace: 1185277153 news.song.fi 27850 81.17.205.61:32832 X-Complaints-To: abuse@song.fi Xref: g2news1.google.com comp.lang.ada:16592 Date: 2007-07-24T14:44:16+03:00 List-Id: Stephen Leake wrote: > Adam Beneschan writes: > > >>On Jul 23, 5:34 am, Stephen Leake >>wrote: >> >>>Rangdalf writes: >>> >>>>Hi, >>> >>>>In C# there is something like Application.startupPath. Is there a >>>>package or function to get this path. >>>>I can get the current directory but I need the application one. >>> >>>In Ada 95, Ada.Command_Line.Command_Name returns the executable name, >>>which usually (not always) has the full path ... >>If we assume that Command_Name returns the name of some (executable) >>file that may or may not be a full path name, then >>Ada.Directories.Full_Name (Ada.Command_Line.Command_Name) should >>return the full path, > > > Yes, this is the right solution. I hardly think so. As I understand it, Full_Name is meant to expand simple file names like "file.txt" and relative file-names like "../../foo/file.txt" into full names by using the default directory and expanding "abbreviations" (A.16 (47)). If the Command_Name is simply "bong.exe", you cannot expect Full_Name to search through the file system to find the directory that contains "bong.exe". There could be several such directories. Full_Name cannot use the PATH envinroment variable to find the directory because PATH only applies to executable files and Full_Name should apply to all files. If Command_Name gives you only the simple name, and you want the full name, I think you must use Ada.Environment_Variables to get the value of PATH and then scan the PATH directories for the Command_Name. But then it would be simpler to just put the "application path" into a well-named environment variable and forget about Command_Name. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .