Permalink
Browse files

Allow drive letters for Win32 #343

  • Loading branch information...
miyagawa committed Oct 23, 2012
1 parent 3958aa4 commit 8778ddfb499ae52984f4a07639cf9734eedabffe
Showing with 7 additions and 1 deletion.
  1. +1 −1 lib/Plack/Util.pm
  2. +6 −0 t/Plack-Util/load.t
View
@@ -125,7 +125,7 @@ END_EVAL
sub _relativize {
my $file = shift;
$file =~ m!^/! ? $file : "./$file";
$file =~ m!^(?:/|[A-Za-z]:)! ? $file : "./$file";
}
sub load_psgi {
View
@@ -67,4 +67,10 @@ use Test::More;
chdir $cwd;
}
{
is Plack::Util::_relativize("/foo/bar.psgi"), "/foo/bar.psgi";
is Plack::Util::_relativize("foo.psgi"), "./foo.psgi";
is Plack::Util::_relativize('C:\x\y.psgi'), 'C:\x\y.psgi';
}
done_testing;

2 comments on commit 8778ddf

@doy

This comment has been minimized.

Show comment
Hide comment
@doy

doy Oct 23, 2012

Member

Wouldn't using File::Spec::rel2abs or something along those lines be a better solution here? This is still going to do the wrong thing for a file on unix with a name that starts with A:.

Member

doy replied Oct 23, 2012

Wouldn't using File::Spec::rel2abs or something along those lines be a better solution here? This is still going to do the wrong thing for a file on unix with a name that starts with A:.

@miyagawa

This comment has been minimized.

Show comment
Hide comment
@miyagawa

miyagawa Oct 23, 2012

Member

Done with 77d1f62

Member

miyagawa replied Oct 23, 2012

Done with 77d1f62

Please sign in to comment.