comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: How to get the application path
Date: Tue, 24 Jul 2007 14:33:09 -0500
Date: 2007-07-24T14:33:09-05:00	[thread overview]
Message-ID: <f85k18$n6d$1@jacob-sparre.dk> (raw)
In-Reply-To: 46a5e4e1$0$27850$39db0f71@news.song.fi

"Niklas Holsti" <niklas.holsti@nospam.please> 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.





  reply	other threads:[~2007-07-24 19:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-23  7:20 How to get the application path Rangdalf
2007-07-23 12:06 ` qouify
2007-07-23 12:34 ` Stephen Leake
2007-07-23 15:27   ` Adam Beneschan
2007-07-23 16:27     ` Markus E Leypold
2007-07-24 11:14       ` Stephen Leake
2007-07-24 11:35         ` Markus E Leypold
2007-07-23 16:37     ` Dmitry A. Kazakov
2007-07-24 11:11     ` Stephen Leake
2007-07-24 11:44       ` Niklas Holsti
2007-07-24 19:33         ` Randy Brukardt [this message]
2007-07-24 20:30           ` Niklas Holsti
2007-07-24 22:01             ` Markus E Leypold
2007-07-24 21:56           ` Markus E Leypold
2007-07-26 10:39             ` Stephen Leake
2007-07-30 23:38               ` Markus E.L.
2007-08-02  4:31                 ` Randy Brukardt
2007-08-02 22:23                   ` Markus E.L. 2
2007-07-24 14:07       ` Robert A Duff
2007-07-24 14:58         ` Adam Beneschan
2007-07-25 10:05         ` Stephen Leake
2007-07-24 14:55       ` Adam Beneschan
2007-07-24 15:41         ` Markus E Leypold
2007-07-25 19:13           ` Randy Brukardt
2007-07-23 18:51 ` Georg Bauhaus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox