use strict;
use warnings;
-use File::Spec::Functions 'catfile';
+use File::Spec::Functions 'catfile', 'splitpath';
+use File::Path 'mkpath';
sub _load {
my ($class, $path) = @_;
sub restore {
my ($class, $key, $content, $args) = @_;
- my $path = catfile($args->{path}, $key);
+ my ($vol, $directory, $file) = splitpath catfile($args->{path}, $key);
+ mkpath($directory) unless -d $directory;
+ my $path = catfile($vol, $directory, $file);
$class->_save($path, $content);
}