From: nickroberts@ukf.net (Nick Roberts)
Subject: Re: How to find directory where the program is?
Date: Sat, 27 Apr 2002 21:12:24 GMT
Date: 2002-04-27T21:12:24+00:00 [thread overview]
Message-ID: <3ccb0c45.64564612@news.cis.dfn.de> (raw)
In-Reply-To: H8BdSXe6G$Zd@eisner.encompasserve.org
On 27 Apr 2002 09:39:03 -0500, Kilgallen@SpamCop.net (Larry Kilgallen)
strongly typed:
>In article <aabjie$pru$1@nh.pace.co.uk>, "Marin David Condic" <dont.bother.mcondic.auntie.spam@[acm.org> writes:
>
>> Most OS's have some means for keeping that kind of thing around somewhere,
>> just that it isn't going to be a "portable" answer. Its the sort of thing
>> that Ada has been very good at hiding in the past - maybe that's something
>> that needs to be in an OS Interface package?
>
>But sometimes there will not be an answer, if you are expecting a
>disk location. On VMS the program you are running might be on
>magnetic tape.
I think we might consider that a bit of a pathological case, nowadays,
Larry!
Besides, I think Marin was suggesting a standard way to obtain
configuration data (not necessarily anything to do with where the
executable is located).
May I propose:
with Ada.IO_Exceptions;
package Ada.Program_Environment is
type Mechanism is (...);
-- implementation defined enumeration type
Default_Mechanism: Mechanism := ...;
-- may be initialised statically or dynamically
function Get_Item (Name: in Wide_String;
Via: in Mechanism := Default_Mechanism)
return Wide_String;
-- returns "" if item not found
procedure Set_Item (Name, Value: in Wide_String;
Via: in Mechanism := Default_Mechanism);
-- may or may not delete if Value=""
procedure Delete_Item (Name: in Wide_String;
Via: in Mechanism := Default_Mechanism);
-- deletes or (if cannot) sets to ""
Name_Error: exception renames Ada.IO_Exceptions.Name_Error;
Use_Error: exception renames Ada.IO_Exceptions.Use_Error;
Device_Error: exception renames Ada.IO_Exceptions.Device_Error;
end Ada.Program_Environment;
The different mechanisms for Windows (32-bit) might be:
( Environment_Variables,
Windows_INI_File,
Program_Home_INI_File,
Registry_User,
Registry_Local,
Registry_System );
Just a thought.
PS: The syntax of names is intended to be left implementation-defined (just
like file names). However, it might be necessary to single out one
punctuation character that must be usable (as a delimiter) with impunity.
Perhaps '.' would be best for this. PPS: '=' is likely to be unusable.
--
Nick Roberts
next prev parent reply other threads:[~2002-04-27 21:12 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-23 18:28 How to find directory where the program is? Preben Randhol
2002-04-23 19:10 ` Florian Weimer
2002-04-23 19:37 ` Randy Brukardt
2002-04-23 20:53 ` Preben Randhol
2002-04-23 21:04 ` Joachim Schr�er
2002-04-24 8:35 ` Thierry Lelegard
2002-04-24 8:43 ` Jean-Pierre Rosen
2002-04-24 10:33 ` Preben Randhol
2002-04-24 11:43 ` Jean-Pierre Rosen
2002-04-24 14:44 ` Preben Randhol
2002-04-24 15:38 ` Hyman Rosen
2002-04-24 17:44 ` Preben Randhol
2002-04-24 23:08 ` Nick Roberts
2002-04-25 7:28 ` Preben Randhol
2002-04-25 14:18 ` Marin David Condic
2002-04-26 16:24 ` Stephen Leake
2002-04-26 20:41 ` achrist
2002-04-26 21:31 ` Larry Kilgallen
2002-04-29 15:38 ` Marin David Condic
2002-04-25 17:10 ` Sergey Koshcheyev
2002-04-25 21:11 ` Nick Roberts
2002-04-25 23:28 ` Sergey Koshcheyev
2002-04-26 5:57 ` Preben Randhol
2002-04-26 16:22 ` Stephen Leake
2002-04-26 17:13 ` Anders Gidenstam
2002-04-26 12:18 ` Jacob Sparre Andersen
2002-04-26 12:23 ` Preben Randhol
2002-04-26 12:48 ` David C. Hoos
2002-04-26 14:13 ` Preben Randhol
2002-04-27 8:18 ` Eric G. Miller
2002-04-26 13:09 ` Marin David Condic
2002-04-27 14:39 ` Larry Kilgallen
2002-04-27 21:12 ` Nick Roberts [this message]
2002-04-29 15:52 ` Marin David Condic
2002-04-24 17:44 ` Egil Harald Hoevik
-- strict thread matches above, loose matches on Subject: below --
2002-04-23 19:24 Beard, Frank [Contractor]
2002-04-23 19:56 Beard, Frank [Contractor]
2002-04-23 22:41 ` Larry Kilgallen
2002-04-23 23:28 Beard, Frank [Contractor]
2002-04-24 0:49 ` Larry Kilgallen
2002-04-24 2:31 ` achrist
2002-04-24 10:29 ` Preben Randhol
2002-04-24 15:28 ` Darren New
2002-04-24 17:43 ` Preben Randhol
2002-04-24 18:33 ` Randy Brukardt
2002-04-24 21:00 ` Wes Groleau
2002-04-25 19:26 ` Randy Brukardt
2002-04-25 2:37 ` Steve Doiel
2002-04-25 7:26 ` Preben Randhol
2002-04-24 9:44 Grein, Christoph
2002-04-25 10:35 ` Thierry Lelegard
2002-04-25 19:30 ` Philippe Waroquiers
2002-04-25 22:57 ` Larry Kilgallen
2002-04-25 16:43 Beard, Frank [Contractor]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox