summaryrefslogtreecommitdiff
path: root/lib/File
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2002-04-11 08:47:21 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2002-04-11 18:40:55 +0000
commit026a9d8a2e74ab543e0da0fdfcc025431d79ff07 (patch)
tree0c74627d0f7e00a171278baa8cc259e7c10a47ea /lib/File
parenteb450546fa7cc8581a3f695c48c038b63329e566 (diff)
downloadperl-026a9d8a2e74ab543e0da0fdfcc025431d79ff07.tar.gz
free CheckTree from the tyranny of the forward slash
From: "Craig A. Berry" <craigberry@mac.com> Message-Id: <a05101500b8db89763fbf@[172.16.52.1]> p4raw-id: //depot/perl@15866
Diffstat (limited to 'lib/File')
-rw-r--r--lib/File/CheckTree.pm6
-rwxr-xr-xlib/File/CheckTree.t2
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/File/CheckTree.pm b/lib/File/CheckTree.pm
index 3da9f20b34..7884ca711e 100644
--- a/lib/File/CheckTree.pm
+++ b/lib/File/CheckTree.pm
@@ -1,8 +1,9 @@
package File::CheckTree;
use 5.006;
-use Exporter;
use Cwd;
+use Exporter;
+use File::Spec;
use warnings;
use strict;
@@ -107,7 +108,8 @@ sub validate {
my $this = $test;
# expand relative $file to full pathname if preceded by cd directive
- $file = $cwd . '/' . $file if $cwd && $file !~ m|^/|;
+ $file = File::Spec->catfile($cwd, $file)
+ if $cwd && !File::Spec->file_name_is_absolute($file);
# put filename in after the test operator
$this =~ s/(-\w\b)/$1 "\$file"/g;
diff --git a/lib/File/CheckTree.t b/lib/File/CheckTree.t
index ae5a311757..0257f4e6f0 100755
--- a/lib/File/CheckTree.t
+++ b/lib/File/CheckTree.t
@@ -116,7 +116,7 @@ chdir(File::Spec->updir) or die "cannot change to parent of t/ directory: $!";
# cd directive followed by relative paths, followed by full paths
{
my ($num_warnings, @warnings, $path_to_libFile, $path_to_dist);
- $path_to_libFile = File::Spec->rel2abs('lib/File');
+ $path_to_libFile = File::Spec->rel2abs(File::Spec->catdir('lib','File'));
$path_to_dist = File::Spec->rel2abs(File::Spec->curdir);
local $SIG{__WARN__} = sub { push @warnings, "@_" };