Skip to content

Commit

Permalink
Use proper paths depending on the OS we're running under
Browse files Browse the repository at this point in the history
  • Loading branch information
ewaters committed May 22, 2012
1 parent e4fc25e commit 8ca7711
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Net/AMQP/Protocol.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use Net::AMQP::Common qw(:all);
use Net::AMQP::Protocol::Base;
use XML::LibXML;
use File::Path;
use File::Spec;

our $VERSION = 0.04;
our ($VERSION_MAJOR, $VERSION_MINOR, %spec);
Expand Down Expand Up @@ -254,14 +255,15 @@ sub full_docs_to_dir {
my $filename;

if ($format eq 'pod') {
$filename = $dir . '/' . $method_class . '.pod';
$filename = File::Spec->catfile($dir, $method_class . '.pod');
}
elsif ($format eq 'pm') {
$filename = $dir . '/' . $method_class . '.pm';
$filename = File::Spec->catfile($dir, $method_class . '.pm');
$filename =~ s{::}{/}g;
}

my ($base_path) = $filename =~ m{^(.+)/[^/]+$};
my ($volume, $directories, undef) = File::Spec->splitpath($filename);
my $base_path = File::Spec->catfile($volume, $directories);
-d $base_path || mkpath($base_path) || die "Can't mkpath $base_path: $!";

open my $podfn, '>', $filename or die "Can't open '$filename' for writing: $!";
Expand Down

0 comments on commit 8ca7711

Please sign in to comment.