delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/12/20/21:09:06

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Fri, 20 Dec 2002 16:16:24 -0800 (PST)
From: Michael A Chase <mchase AT ix DOT netcom DOT com>
Subject: Re: Perl package File::Spec confused under cygwin
To: cygwin AT cygwin DOT com, "linda w (cyg)" <cygwin AT tlinx DOT org>
Message-ID: <Mahogany-0.64.2-1149-20021220-161624.00@ix.netcom.com>
MIME-Version: 1.0
references: <001b01c2a86e$a5da95f0$1403a8c0 AT sc DOT tlinx DOT org>
in-reply-to: <001b01c2a86e$a5da95f0$1403a8c0@sc.tlinx.org>
Reply-To: Michael A Chase <mchase AT ix DOT netcom DOT com>

On Fri, 20 Dec 2002 13:27:50 -0800 "linda w (cyg)" <cygwin AT tlinx DOT org> wrote:

> File::Spec is supposed to provide a OS independent way of parsing and
> creating pathnames.  For example, a 'splitpath' can product a volume
> $dir and $file.  

Note that Cygwin, like Unix, doesn't have a concept of volume.  Everything
except network paths (//host/dir) are based on a single root directory. 

> I'm not sure what constitutes a volume but I'd think C: D: would count
> as separate.

Mixed file specifications like c:/x/y/z are handled by many programs in the
Cygwin environment, but such paths are not really valid.  File::Spec::Win32
accepts '/' as well as '\' as a directory separator.

> Under cygwin, it only handles/parses unix pathnames but not native
> windows pathnames 'c:\windows\filename' will yield a vol='', dir='' and
> filename='d:\windows\filelname' -- not what one would expect.  Using
> forward slashes yields: vdf='', 'd:/windows/,'filename'.

That's exactly the situation.  File::Spec::Cygwin for Perl 5.8 only
overrides file_name_is_absolute() and canonpath(); other than that it's
pure File::Spec::Unix.  I'm sure the Perl Porters would be willing to
examine a patch to handle mixed specs.

> Further use to break down the directory path into components would
> yield D: as a first directory and 'windows' as a 2nd level dir. 
> Note that the forward slash has now disappeared indicating what I believe
> to be improper symantics as d:windows != D:\windows unless d:'s curdir
> is = to the root dir.

You can always call File::Spec::Win32 -> splitpath() to get that behavior.

> Guess when the module detects the OS type, it needs to have a separate
> type for the cygwin environment.

It does, but File::Spec::Cygwin is very close to File::Spec::Unix.

-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.



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

- Raw text -


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