Permalink
Browse files

Check whether cachedir was created when mkpath returned false

  • Loading branch information...
1 parent 6100f34 commit fef6d7c88053032619c2d6cf0cacc97dc4a7220a @hitode909 committed Jan 23, 2014
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/Text/Xslate.pm
View
@@ -409,8 +409,10 @@ sub _load_source {
my $cachedir = File::Spec->catpath($volume, $dir, '');
if(not -e $cachedir) {
require File::Path;
- eval { File::Path::mkpath($cachedir) }
- or Carp::croak("Xslate: Cannot prepare cache directory $cachepath (ignored): $@");
+ my $created = eval { File::Path::mkpath($cachedir) };
+ if (!$created && ! -e $cachedir) {
+ Carp::croak("Xslate: Cannot prepare cache directory $cachepath (ignored): $@");
+ }
}
my $tmpfile = sprintf('%s.%d.d', $cachepath, $$, $self);

0 comments on commit fef6d7c

Please sign in to comment.