delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/05/20/12:11:20

X-Spam-Check-By: sourceware.org
Message-ID: <46507312.2EDBD2A5@dessent.net>
Date: Sun, 20 May 2007 09:10:58 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: How to uniformly point to the root of a drive?
References: <f2por8$as9$1 AT sea DOT gmane DOT org> <46506BA1 DOT C3502CCD AT dessent DOT net> <0a3801c79af6$c32395b0$2e08a8c0 AT CAM DOT ARTIMI DOT COM>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
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

Dave Korn wrote:

>   This relies on the mountpoints being set correctly, which might not work if
> your drive letter changes ...

Well if that is the case and / points to the wrong dir then I don't see
how you can be using Cygwin at all, so many things will be broken.  To
get the POSIX path of the rootdir of the drive correponding to the CWD,
then you can use something like:

whatever="$(mount -p | tail -n1 | cut -f1 -d' ')$(cmd.exe /c "cd" \
          | cut -b1 | tr 'A-Z' 'a-z')"

But I don't see how this is useful in the least, since by definition if
the mount table does not refelect reality then using POSIX paths for any
purpose is unreliable at best and a waste of time at worst, so finding
the POSIX path corresponding to the rootdir seems pointless.  If you
want to update the mount table you need the win32 path, not the POSIX
path, and if the mount table has already been updated then this is much
simpler.

Brian

--
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