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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,814d0ec938d6e4da X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-26 13:41:16 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: achrist@easystreet.com Newsgroups: comp.lang.ada Subject: Re: How to find directory where the program is? Date: Fri, 26 Apr 2002 13:41:36 -0700 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <3CC9BB80.7ADF4C8D@easystreet.com> X-Mailer: Mozilla 4.79 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 References: <3CC6D15A.2070509@mail.com> <3cc73115.426446486@news.cis.dfn.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:23155 Date: 2002-04-26T13:41:36-07:00 List-Id: Stephen Leake wrote: > > Most OS's have "environment variables". The hard part is getting the > installer to set the appropriate environment variable. > Problem if the installer runs on machine A and then user tries to execute the program from machine 2. Much worse is the possibility that sometime during the lifetime of the installed program, the computer will be messed with by someone who removes the environment variable to clean up the environment or tidy up the startup script that sets the variables. The environment is not a database; if a computer has lots of software installed and lots of environment settings, this is both an efficiency issue and a management problem. A user-friendly program will not simply crash if the required environment is missing. My preferred approach is like the method of Hansel and Gretel in the deep woods -- drop lots of breadcrumbs. If you can't find your way based on the command line, look in the current directory; if the current directory is no help, look in the environment (or the registry); if the environment doesn't help, look along the PATH; if the path is no help, look in the program's directory. This gives some opportunity for confusion, but it also allows a hierarchical set of defaults and overrides of various options. In particular, it also llows running/testing of multiple versions of the same program on the same machine with different settings that maybe don't interfere with each other. Al