From: Perl 5 Porters Date: Tue, 18 Jun 1996 07:33:04 +0000 (+0000) Subject: perl 5.003_01: lib/File/Find.pm X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9f637d3dc06a0532b841706ccff8d4aa8744fb13;p=p5sagit%2Fp5-mst-13.2.git perl 5.003_01: lib/File/Find.pm Clip off '\dir' suffix under Win32 Fix inversion in recording return values from fileparse() --- diff --git a/lib/File/Find.pm b/lib/File/Find.pm index 02bacd8..39fab7b 100644 --- a/lib/File/Find.pm +++ b/lib/File/Find.pm @@ -82,7 +82,8 @@ sub find { &$wanted; my $fixtopdir = $topdir; $fixtopdir =~ s,/$,, ; - $fixtopdir =~ s/\.dir$// if $Is_VMS; ; + $fixtopdir =~ s/\.dir$// if $Is_VMS; + $fixtopdir =~ s/\\dir$// if $Is_NT; &finddir($wanted,$fixtopdir,$topnlink); } else { @@ -90,7 +91,7 @@ sub find { } } else { - unless (($dir,$_) = File::Basename::fileparse($topdir)) { + unless (($_,$dir) = File::Basename::fileparse($topdir)) { ($dir,$_) = ('.', $topdir); } $name = $topdir; @@ -142,6 +143,7 @@ sub finddir { if (!$prune && chdir $_) { $name =~ s/\.dir$// if $Is_VMS; + $name =~ s/\\dir$// if $Is_NT; &finddir($wanted,$name,$nlink); chdir '..'; } @@ -167,6 +169,7 @@ sub finddepth { my $fixtopdir = $topdir; $fixtopdir =~ s,/$,, ; $fixtopdir =~ s/\.dir$// if $Is_VMS; + $fixtopdir =~ s/\\dir$// if $Is_NT; &finddepthdir($wanted,$fixtopdir,$topnlink); ($dir,$_) = ($fixtopdir,'.'); $name = $fixtopdir; @@ -177,7 +180,7 @@ sub finddepth { } } else { - unless (($dir,$_) = File::Basename::fileparse($topdir)) { + unless (($_,$dir) = File::Basename::fileparse($topdir)) { ($dir,$_) = ('.', $topdir); } chdir $dir && &$wanted; @@ -225,6 +228,7 @@ sub finddepthdir { if (chdir $_) { $name =~ s/\.dir$// if $Is_VMS; + $name =~ s/\\dir$// if $Is_NT; &finddepthdir($wanted,$name,$nlink); chdir '..'; } @@ -247,9 +251,12 @@ if ($^O eq 'VMS') { $Is_VMS = 1; $dont_use_nlink = 1; } +if ($^O =~ m:^mswin32:i) { + $Is_NT = 1; + $dont_use_nlink = 1; +} $dont_use_nlink = 1 if $^O eq 'os2'; -$dont_use_nlink = 1 if $^O =~ m:^mswin32$:i ; 1;