Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!uunet!mcsun!hp4nl!phigate!ehviea!sun4dts!derek From: derek@sun4dts.dts.ine.philips.nl (derek) Newsgroups: comp.os.msdos.programmer Subject: Re: Where's the executable located? Message-ID: <745@sun4dts.dts.ine.philips.nl> Date: 26 Jun 91 14:53:08 GMT Article-I.D.: sun4dts.745 References: <1991Jun24.133431.10280@druid.uucp> <2613@gold.gvg.tek.com> <1991Jun25.174819.7992@netcom.COM> Distribution: comp Lines: 67 resnicks@netcom.COM (Steve Resnick) writes: >In article <2613@gold.gvg.tek.com> shaunc@gold.gvg.tek.com (Shaun Case) writes: >>In article <1991Jun24.133431.10280@druid.uucp> darcy@druid.uucp (D'Arcy J.M. Cain) writes: >>>In melling@cs.psu.edu (Michael D Mellinger) writes: >>>>If my program is in someone's path, how can I tell where it's located >>>>so that I can get the supporting files that are needed with it? >>> >>>This is real easy in DOS. argv[0] is the full pathname of the invoking >>>process. I often do something like this: >>> >> >>... assuming you are using a version of dos above 2.10, which >>does not support argv[0]. People are still using it, unfortunately. >> >SoapBox: On >I would say to those running < DOS 3.1, "TOUGH!" We're THREE major >releases and a good 6 years from the time when 2.1 was released. I can >understand not fixing something that isn't broken, but if new software >breaks it, then the old DOS is broken, not the new program. Were it >the other way around, we would still be using dBASE II, Perfect Writer >and Perfect Calc on CP/M machines, or worse yet, TRS DOS. >SoapBox: Off >Cheers! >Steve >-- >------------------------------------------------------------------------------- > resnicks@netcom.com, steve@camphq, IFNA: 1:143/105.0, > co moderator for comp.binaries.os2 > Real life: Steve Resnick. Chief Software Architect, Process Scientific, Inc > Flames, grammar and spelling errors >/dev/null > The Asylum OS/2 BBS - (408)263-8017 12/2400,8,1 - Running Maximus CBCS 1.2 >------------------------------------------------------------------------------- I don't think that's so good an attitude - some people are forced into using the dos they have. Compromize is the name of the game. If the user has a low numbered Dos, they have to make a couple of sacrifices for you (just don't forget to mention that in the documentation). The files must be: 1. In the current directory 2. In the root of the current drive (easiest for floppy users) 3. Defined in an environment variable. You could also check the path. None of this is particularly difficult to do: Check the dos version if ver < 3.1 /* or something */ check for environment variable if not found check for file in current directory if not found check for file in root if not found, exit gracefully. Don't forget to tell the user he shouldn't rename the file ( dos <) So - tell me why you shouldn't take these simple steps to make all potential users happy, and I'll tell you, or rather they'll tell you what you can do with your software. (Irony alert!) Best Regards, Derek Carr DEREK@DTS.INE.PHILIPS.NL Philips IE TQV-5 Eindhoven, The Netherlands Standard Disclaimers apply.