use filetest 'access';
# Load dependancies
-use Carp qw(carp);
+use Carp qw(carp confess);
use DateTime;
+use File::Path qw(make_path);
use File::stat qw(stat);
use File::Spec;
use File::Slurp qw(read_file write_file);
next;
}
+ # Check that key directory exists
+ if (! -d KEY_DIR) {
+ # Create all paths
+ make_path(KEY_DIR, {error => \my $err});
+ if (@$err) {
+ map {
+ my ($file, $msg) = %$_;
+ carp ($file eq '' ? '' : $file.': ').$msg if ($debug);
+ } @$err;
+ confess 'make_path failed';
+ }
+ }
+
# Unlink if is a symlink
if (-l KEY_DIR.DS.SERVER_KEY) {
unless(unlink(KEY_DIR.DS.SERVER_KEY)) {