Re: [MacPerl-Porters] [PATCHES] A new catdir()
[email protected] (Chris Nandor)
| Newsgroups | perl.macperl.porters |
|---|---|
| Message-ID | <p0510030ab7f3265d4faa@[10.0.1.177]> |
At 09:42 +0200 2001.10.17, Thomas Wegner wrote:
>At 20:24 Uhr -0400 15.10.2001, Chris Nandor wrote:
>>Hm. I get this error:
>>
>>not ok 353 # Mac->abs2rel('hd:','hd:d1:d2:'): got ':::Bourque:', expected
>>':::'
>>
>>Of course, Bourque is my startup volume. However, I am running the test on
>>a separate volume, Bird.
>>
>
>Hm ...? That's odd. I cannot reproduce this error and I cannot find an
>error in F::S::Mac.pm, no matter if I run the test on a separate volume or
>not (this shouldn't matter anyway). Will you please do me a favour? I've
>attached a slightly changed debugging version of Mac.pm, which produces
>some trace output
for Mac->abs2rel(). Can you please run the test again and send me the
output for
Hmmm. Here is your original patch (a chunk of it). Note the addition of
the if/else for $path_dirs.
@@ -521,14 +668,18 @@
shift @pathchunks ;
shift @basechunks ;
}
-
+
# @pathchunks now has the directories to descend in to.
- $path_dirs = $self->catdir( @pathchunks );
+ if ( (@pathchunks) && ($pathchunks[0] ne '') ) {
+ $path_dirs = $self->catdir( @pathchunks );
+ } else {
+ $path_dirs = '';
+ }
# @basechunks now contains the number of directories to climb out of.
$base_dirs = (':' x @basechunks) . ':' ;
- return $self->catpath( '', $base_dirs . $path_dirs, $path_file ) ;
+ return $self->catpath( '', $self->catdir( $base_dirs, $path_dirs ),
$path_file ) ;
}
=item rel2abs
However, in the latest version, you have this line instead:
$path_dirs = $self->catdir( ':', @pathchunks );
When changing it to use that line, all tests pass. Thanks, this looks good.
--
Chris Nandor [email protected] http://pudge.net/
Open Source Development Network [email protected] http://osdn.com/