This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Determining the location of a Cygwin installation


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]