Skip to content

Commit

Permalink
Check whether cachedir was created when mkpath returned false
Browse files Browse the repository at this point in the history
  • Loading branch information
hitode909 committed Jan 23, 2014
1 parent 6100f34 commit fef6d7c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Text/Xslate.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -409,8 +409,10 @@ sub _load_source {
my $cachedir = File::Spec->catpath($volume, $dir, ''); my $cachedir = File::Spec->catpath($volume, $dir, '');
if(not -e $cachedir) { if(not -e $cachedir) {
require File::Path; require File::Path;
eval { File::Path::mkpath($cachedir) } my $created = eval { File::Path::mkpath($cachedir) };
or Carp::croak("Xslate: Cannot prepare cache directory $cachepath (ignored): $@"); if (!$created && ! -e $cachedir) {
Carp::croak("Xslate: Cannot prepare cache directory $cachepath (ignored): $@");
}
} }


my $tmpfile = sprintf('%s.%d.d', $cachepath, $$, $self); my $tmpfile = sprintf('%s.%d.d', $cachepath, $$, $self);
Expand Down

0 comments on commit fef6d7c

Please sign in to comment.