comp.lang.ada
 help / color / mirror / Atom feed
From: Markus E Leypold <development-2006-8ecbb5cc8aREMOVETHIS@ANDTHATm-e-leypold.de>
Subject: Re: How to get the application path
Date: Wed, 25 Jul 2007 00:01:07 +0200
Date: 2007-07-25T00:01:07+02:00	[thread overview]
Message-ID: <477iopzckc.fsf@hod.lan.m-e-leypold.de> (raw)
In-Reply-To: 46a66112$0$3218$39db0f71@news.song.fi


> Randy Brukardt wrote:
>> "Niklas Holsti" <niklas.holsti@nospam.please> wrote in message
>> news:46a5e4e1$0$27850$39db0f71@news.song.fi...
>> ...
>
>>>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).
>
> I had in mind that the application installer tool would set up the
> environment variable somehow (system-dependent no doubt). Indeed users
> should not be troubled with that.


In Unix a shell script wrapper can set the environment variable. In
Windows there is a way to set the startup path in the registry, this
becomes the current directory when the application is started from the
desktop ("by icon"). Make that path be the place where you install all
files belonging to the application (maybe also including a app.ini
file which has the location of other relocatable parts of the
installation and will be generated at install time. 

Now you can record the current directory at app startup as
installation directory and read the rest of the paths from
$installationdirectory/app.ini when needed.

Mission accomplished.

Regards -- Markus




  reply	other threads:[~2007-07-24 22:01 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
2007-07-24 20:30           ` Niklas Holsti
2007-07-24 22:01             ` Markus E Leypold [this message]
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