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> <0kbqe1zcrk.fsf@hod.lan.m-e-leypold.de> From: development-2006-8ecbb5cc8aREMOVETHIS@ANDTHATm-e-leypold.de (Markus E.L.) Organization: N/A Date: Tue, 31 Jul 2007 01:38:17 +0200 Message-ID: User-Agent: Some cool user agent (SCUG) Cancel-Lock: sha1:0eZrEzeTD2AcZ3BqMGLBERvbjDc= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 88.72.241.161 X-Trace: news.arcor-ip.de 1185838029 88.72.241.161 (31 Jul 2007 01:27:09 +0200) X-Complaints-To: abuse@arcor-ip.de Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!fdn.fr!club-internet.fr!feedme-small.clubint.net!news.unit0.net!newsfeed.arcor-ip.de!news.arcor-ip.de!not-for-mail Xref: g2news2.google.com comp.lang.ada:1304 Date: 2007-07-31T01:38:17+02:00 List-Id: > Markus E Leypold writes: > >> Now, on Unix I'd just put a shell script wrapper in place of the executable: > > Why do you limit this to "Unix"? Any operating system that supports > shells can do the same thing. Yes+No. In Unix I can just exec the real binary, so I don't have a shell process waiting until the the binary proper returns. In Windows the shell process will (AFAI understand it) exist until the application terminates and AFAIS (worse) it will even have a command line window open to the absolute irritation of the lay user. If I do the right things (use start.exe, for once) the shell window will open only shortly, but will still irritate the user. I find the Unix way more palatable. >> MYPATH="$0" >> MYAPP="$(which $MYPATH.bin)" # locate the executable proper >> >> export EXE_PATH="$MYPATH" >> >> exec $MYAPP "$@" >> >> (untested, mind you). >> >> That would even put the full path in argv[0]. The power of shell >> script wrappers in Unix is usually underestimated. > > Scratch the "in Unix", and I agree. Could you tell me the equivalent of my script in CMD.exe? (Seriously, that's a real question: What I got until now I consider kludgy). > A Windows icon can launch a cmd shell wrapper. Or a Cygwin bash > wrapper, for that matter! Yes, but cygwin has problems of its own (security for once, it's rather intrusive), so it's not OK in my opinion to run it at end user machines (at least w/o much further research to be done which is a bit difficult given the general attitude ("BWAM") at the cygwin mailing lists :-(.) Regards -- Markus