This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
The rest of [perl #71710] fixes for File::Find
authorAlex Davies <alex.davies@talktalk.net>
Fri, 24 Sep 2010 07:12:27 +0000 (00:12 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 24 Sep 2010 07:12:27 +0000 (00:12 -0700)
The code is from Alex Davies. The commit message is from the committer.

Somehow I only ended up with half the patch applied. No tests failed
for me, because these code paths are only reached on Windows, which,
thankfully, I am not using.

Hopefully this will eliminate the smoke that is already pouring in....

(It’s *my* turn to break blead for Windows. :-)

lib/File/Find.pm

index 27c9466..92fe636 100644 (file)
@@ -927,8 +927,9 @@ sub _find_dir($$$) {
                $CdLvl = $Level;
            }
 
-           if ($^O eq 'MSWin32') {
-               $dir_name = ($p_dir =~ m|\w:/?$| ? "$p_dir$dir_rel" : "$p_dir/$dir_rel");
+           if ($Is_Win32) {
+               $dir_name = ($p_dir =~ m{^(?:\w:[/\\]?|[/\\])$}
+                   ? "$p_dir$dir_rel" : "$p_dir/$dir_rel");
                $dir_pref = "$dir_name/";
            }
            elsif ($^O eq 'VMS') {
@@ -1206,13 +1207,16 @@ if ($^O eq 'VMS') {
     $Is_VMS = 1;
     $File::Find::dont_use_nlink  = 1;
 }
+elsif ($^O eq 'MSWin32') {
+    $Is_Win32 = 1;
+}
 
 # this _should_ work properly on all platforms
 # where File::Find can be expected to work
 $File::Find::current_dir = File::Spec->curdir || '.';
 
 $File::Find::dont_use_nlink = 1
-    if $^O eq 'os2' || $^O eq 'dos' || $^O eq 'amigaos' || $^O eq 'MSWin32' ||
+    if $^O eq 'os2' || $^O eq 'dos' || $^O eq 'amigaos' || $Is_Win32 ||
        $^O eq 'interix' || $^O eq 'cygwin' || $^O eq 'epoc' || $^O eq 'qnx' ||
           $^O eq 'nto';