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 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> <46a5e4e1$0$27850$39db0f71@news.song.fi> <46a66112$0$3218$39db0f71@news.song.fi> From: Markus E Leypold Organization: N/A Date: Wed, 25 Jul 2007 00:01:07 +0200 Message-ID: <477iopzckc.fsf@hod.lan.m-e-leypold.de> User-Agent: Some cool user agent (SCUG) Cancel-Lock: sha1:pO7t09OtNB++Z7uRZuEeEGZiMbo= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 88.72.211.100 X-Trace: news.arcor-ip.de 1185313807 88.72.211.100 (24 Jul 2007 23:50:07 +0200) X-Complaints-To: abuse@arcor-ip.de Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!news.mixmin.net!newsfeeder.dynfx.net!news.unit0.net!newsfeed.arcor-ip.de!news.arcor-ip.de!not-for-mail Xref: g2news2.google.com comp.lang.ada:1162 Date: 2007-07-25T00:01:07+02:00 List-Id: > Randy Brukardt wrote: >> "Niklas Holsti" 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