$Revision
=
'5.3901 (6-Mar-1997)'
;
@ISA
=
qw(File::Spec::Unix)
;
Exporter::
import
(
'File::Spec'
,
'$Verbose'
);
sub
catdir {
my
(
$self
,
@dirs
) =
@_
;
my
(
$dir
) =
pop
@dirs
;
@dirs
=
grep
(
$_
,
@dirs
);
my
(
$rslt
);
if
(
@dirs
) {
my
(
$path
) = (
@dirs
== 1 ?
$dirs
[0] :
$self
->catdir(
@dirs
));
my
(
$spath
,
$sdir
) = (
$path
,
$dir
);
$spath
=~ s/.dir$//;
$sdir
=~ s/.dir$//;
$sdir
=
$self
->eliminate_macros(
$sdir
)
unless
$sdir
=~ /^[\w\-]+$/;
$rslt
=
$self
->fixpath(
$self
->eliminate_macros(
$spath
).
"/$sdir"
,1);
}
else
{
if
(
$dir
=~ /^\$\([^\)]+\)$/) {
$rslt
=
$dir
; }
else
{
$rslt
= vmspath(
$dir
); }
}
print
"catdir("
,
join
(
','
,
@_
[1..
$#_
]),
") = |$rslt|\n"
if
$Verbose
>= 3;
$rslt
;
}
sub
catfile {
my
(
$self
,
@files
) =
@_
;
my
(
$file
) =
pop
@files
;
@files
=
grep
(
$_
,
@files
);
my
(
$rslt
);
if
(
@files
) {
my
(
$path
) = (
@files
== 1 ?
$files
[0] :
$self
->catdir(
@files
));
my
(
$spath
) =
$path
;
$spath
=~ s/.dir$//;
if
(
$spath
=~ /^[^\)\]\/:>]+\)$/ && basename(
$file
) eq
$file
) {
$rslt
=
"$spath$file"
; }
else
{
$rslt
=
$self
->eliminate_macros(
$spath
);
$rslt
= vmsify(
$rslt
.(
$rslt
?
'/'
:
''
).unixify(
$file
));
}
}
else
{
$rslt
= vmsify(
$file
); }
print
"catfile("
,
join
(
','
,
@_
[1..
$#_
]),
") = |$rslt|\n"
if
$Verbose
>= 3;
$rslt
;
}
sub
curdir {
return
'[]'
;
}
sub
rootdir {
return
''
;
}
sub
updir {
return
'[-]'
;
}
sub
path {
my
(
@dirs
,
$dir
,
$i
);
while
(
$dir
=
$ENV
{
'DCL$PATH;'
.
$i
++}) {
push
(
@dirs
,
$dir
); }
@dirs
;
}
sub
file_name_is_absolute {
my
(
$self
,
$file
) =
@_
;
$file
=
$ENV
{
$file
}
while
$file
=~ /^[\w\$\-]+$/ and
$ENV
{
$file
};
$file
=~ m!^/! or
$file
=~ m![<\[][^.\-\]>]! or
$file
=~ /:[^<\[]/;
}
1;