Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Wed, 26 Mar 2003 15:35:47 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Elfyn McBratney cc: cygwin , Andrew DeFaria Subject: Re: Determining the location of a Cygwin installation In-Reply-To: <00ab01c2f3d4$e9b05920$cf6d86d9@ellixia> Message-ID: Importance: Normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 26 Mar 2003, Elfyn McBratney wrote: > > Rolf Campbell wrote: > > > > > You mean "cygpath -w -p /bin", because he said "I need to determine > > > the native path to the directory containing cygwin1.dll" > > > > He also said he needed to determine this from "outside the Cygwin > > environment" and I would think that cygpath is inside the Cygwin > > environment. Think about it. You're in cmd.exe and you want to tell > > where Cygwin is installed. How can you execute cygpath without knowing > > where cygpath is? The only way that would work is if Cygwin's bin path > > is already in PATH and this is not set by default when Cygwin is > > installed. > > > > Personally I vote for a simple base like registry variable that plainly > > states where Cygwin was installed. It seems to me to make the most sense > > to have one globally accessible place where you can find Cygwin's > > installation path and then you can take it from there. Relying on > > anything within Cygwin's installation path presupposes that the person > > knows Cygwin's installation path! But this is just my opinion... > > But as cgf (the Really Cool Manager) said the registry keys are not to be > relied on as they might not be there forever. Thinking about this I'd use > Win32 API calls (FindFirstFileEx and CreateFile) to search a drive for items > named "bin" and see if it's a) a folder and b) contains cygwin1.dll . > > Regards, > Elfyn McBratney I think you're putting too much into cgf's words. He didn't say "don't use the registry", he said "if you use the registry, beware of changes". There will *always* be a way to determine where Cygwin is installed (if not the registry, then something else), if only because it's needed for setup.exe, and likely nothing so drastic as the full drive search you propose. So, the short answer is: you can use the registry for now, and when in doubt, do what setup.exe does - that should always be up-to-date. :-) Igor P.S. Maybe we could factor out the code that detects a Cygwin installation from setup into a library, and distribute a small cygdetect.exe that links with it? -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk! -- /usr/games/fortune -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/