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: g2news2.google.com!news2.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: How to get the application path Date: Tue, 24 Jul 2007 14:33:09 -0500 Organization: Jacob's private Usenet server Message-ID: References: <46a456aa$0$25908$426a34cc@news.free.fr> <1185204459.328520.240930@z24g2000prh.googlegroups.com> <46a5e4e1$0$27850$39db0f71@news.song.fi> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1185305448 23757 69.95.181.76 (24 Jul 2007 19:30:48 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 24 Jul 2007 19:30:48 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896 Xref: g2news2.google.com comp.lang.ada:1133 Date: 2007-07-24T14:33:09-05:00 List-Id: "Niklas Holsti" wrote in message news:46a5e4e1$0$27850$39db0f71@news.song.fi... ... > 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. Well, on Janus/Ada the Path applies to all files (Open searches the path if given a simple file name). This cames from inadequate DOS documentation when we were building our compiler in the early 1980's, and an unwillingness to break existing code. Anyway, in Janus/Ada 95, all you do is open "Bong.Exe" and then ask for the Name; that will definitely find the file and return its full path. Not sure whether the Amendment updates will change that (probably not, it would break all of our code...). > 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. Yes, that's how you'd have to do it in general. Yuck. (At least you can do that with Ada.Directories.) I don't see how an Ada program could put the application path into an environment variable, though; this is the sort of thing that I wouldn't want to have to go outside of Ada to do (because it would depend on the user "doing the right thing", and we all know that users often don't do the right thing). Randy.