delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/02/09/21:07:46

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4990E0BF.1010502@cygwin.com>
Date: Mon, 09 Feb 2009 21:04:47 -0500
From: "Larry Hall (Cygwin)" <reply-to-list-only-lh AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20090101 Remi/2.0.0.19-1.fc8.remi Lightning/0.9 Thunderbird/2.0.0.19 Mnenhy/0.7.5.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: How does one find "cygdrive path" in a Win ".bat" file
References: <4990B031 DOT 4050807 AT tlinx DOT org> <4990B128 DOT 7030004 AT cygwin DOT com> <4990CB8D DOT 3050704 AT tlinx DOT org> <4990D05A DOT 4050202 AT cygwin DOT com> <4990DA52 DOT 9050900 AT tlinx DOT org>
In-Reply-To: <4990DA52.9050900@tlinx.org>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Linda Walsh wrote:
> Larry Hall (Cygwin) wrote:
>> Linda Walsh wrote:
>>> Larry Hall (Cygwin X) wrote:
>>>> Linda Walsh wrote:
>>>>> The startxwin.sh script works, but startxwin.bat does not work if
>>>>> your Cygwin installation isn't in the default location.
>>>>>
>>>>> You could use "mount -p" (presuming your cygwin\bin is in your 
>>>>> windows path, as mine is).
>>>>>
>>>>> If not, need to look in the registry:
>>>>> "\HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts 
>>>>> v2\cygdrive prefix"
>>>>
>>>> No, you don't need to look in the registry.  There's nothing there that
>>>> 'mount' won't tell you.  Forget about the registry.  You'll be better
>>>> off, especially when Cygwin 1.7 is released.
>>> ---
>>>     I'm curious -- how does mount find or 'know' the cygdrive path
>>> if it doesn't come from the registry.
>>
>> How it finds it is an implementation detail.  There's no need to know
>> how it does what it does if it does what you want. ;-)  And, like I said,
>> the registry won't be used for 1.7 so anyone that uses this as a basis
>> of anything will find it "broken" once 1.7 is released.
>>
>>>     For that matter, how would a windows .bat file find the
>>> 'mount.exe' binary if the .bat file doesn't know 'cygdrive path'?
>>
>> That's a different issue. 
> ---
>     Then answer the question.  First you avoid the answer by saying
> it is an implementation detail.

<long winded response deleted>

Linda, you've been around this list long enough to understand how to
handle them.  Please, if you want to berate someone for answering
your posts, do it on one list only.  Of course, I'm having trouble seeing
the benefit of continuing with either thread, given your stubbornness to
hold onto the notion that there must be a complicated way to solve this
problem.  So let me summarize once more.  You can take it as your answer
or not.

   1. Going to the registry in general for information you can get from
      the Cygwin 'mount' command is not supported and is error prone.

   2. Providing the proper path in 'startxwin.bat' does not require
      special analysis of the registry, file system, or any other source
      to find the proper root for Cygwin.  There are at least two ways of
      directly solving this robustly:

        a. Have 'setup.exe' do it, like it does for 'cygwin.bat'
        b. Use the path to 'startxwin.bat' as the path (it is in the
           Cygwin installation path after all).

   3. If you need to do this generically for any batch file, then yes,
      you have to rely on external data and heuristics.  Going to the
      registry to see if it will help or searching the file system are
      two alternatives but there is no one key or one spot that will
      unequivocally give you the installation path.  Looking at the
      mount paths in the registry will work for 1.5 but is flawed for 1.7.
      Looking in the file-system may work depending on what you look
      for and where you start looking.

Hopefully this summary of what I've said already is clear and compact
enough for you to understand what I'm saying.  If not, I'll leave you
to enjoy your continued quest unimpeded by more answers from me.
If you don't like this answer, please feel free to post more long-winded
prose that picks each word of my response apart such that it looses all
context.  But I think it's fair to say that the thread will end after that.
There's really nothing worthwhile that can be said relative to your inquiry
that hasn't already been covered.

-- 
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019