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: Perl package File::Spec confused under cygwin


On Fri, 20 Dec 2002 13:27:50 -0800 "linda w (cyg)" <cygwin@tlinx.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/


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