X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Message-ID: <4AF495B0.7090607@bopp.net> Date: Fri, 06 Nov 2009 15:31:28 -0600 From: Jeremy Bopp User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: 1.7] Can you have multipe cygdrive path prefixes active at once References: <26227605 DOT post AT talk DOT nabble DOT com> <26227607 DOT post AT talk DOT nabble DOT com> <4AF3C9FE DOT 806 AT bopp DOT net> <26230853 DOT post AT talk DOT nabble DOT com> In-Reply-To: <26230853.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 aputerguy wrote: > Jeremy Bopp wrote: >> aputerguy wrote: >>> In particular, I can't use "mount -p" to distinguish between prefixes >>> that >>> might have (variable) number of trailing spaces (which is allowed). >> I believe that you want to use the cygpath program if you want to >> convert POSIX paths to Windows paths reliably. Assuming the default >> cygdrive prefix is in use: >> >> $ cygpath -w /cygdrive/c/an/example/posix/path >> C:\an\example\posix\path > > All true and known. BUT I want to know the cygdrive prefix in general for > use in future constructions rather than just making a single path. Say if I > want to find all files, I want to do something like "find Well, it's a bit of a hack, but you could try something like the following: $ dirname $(cygpath -u C:/) This assumes that there is always a C: drive and converts the path to the root of that drive into a POSIX path which will include the cygdrive prefix. Then dirname is used to effectively chop off the drive letter leaving you with the cygdrive prefix. If you're thinking that you can run something like ls or find the cygdrive prefix and enumerate all of the drives on the system, you should know that it won't work in some cases, such as when someone sets their cygdrive prefix to "/". In this case, the drives are still available explicitly as /c, /d, etc. but they will not be enumerated by "ls /" or "find /". -Jeremy -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple