diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-11-22 11:17:43 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-11-22 11:26:58 +0100 |
commit | 0db2d2145810e93801dd77f5f016647a606e1f73 (patch) | |
tree | 2f62056e36e39d5604c39811a4c9921603265f26 | |
parent | b7d10e6a9dfe7851479e6948b92c72f240555497 (diff) | |
download | App-BorgRestore-0db2d2145810e93801dd77f5f016647a606e1f73.tar.gz App-BorgRestore-0db2d2145810e93801dd77f5f016647a606e1f73.tar.xz |
Create cache directory in DB instead of Settings
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | META.json | 2 | ||||
-rw-r--r-- | cpanfile | 2 | ||||
-rw-r--r-- | lib/App/BorgRestore/DB.pm | 4 | ||||
-rw-r--r-- | lib/App/BorgRestore/Settings.pm | 4 |
4 files changed, 6 insertions, 6 deletions
@@ -46,7 +46,6 @@ "DBD::SQLite" : "0", "DBI" : "0", "Date::Parse" : "0", - "File::Path" : "0", "File::Temp" : "0", "File::pushd" : "0", "Function::Parameters" : "0", @@ -61,6 +60,7 @@ "Log::Log4perl::Appender::ScreenColoredLevels" : "0", "Log::Log4perl::Layout::PatternLayout" : "0", "Log::Log4perl::Level" : "0", + "Path::Tiny" : "0", "Pod::Usage" : "0", "Version::Compare" : "0", "autodie" : "0", @@ -1,6 +1,6 @@ requires 'DBD::SQLite'; requires 'DBI'; -requires 'File::Path'; +requires 'Path::Tiny'; requires 'File::Temp'; requires 'File::pushd'; requires 'Function::Parameters'; diff --git a/lib/App/BorgRestore/DB.pm b/lib/App/BorgRestore/DB.pm index 35975d6..0bc5214 100644 --- a/lib/App/BorgRestore/DB.pm +++ b/lib/App/BorgRestore/DB.pm @@ -9,6 +9,7 @@ use autodie; use DBI; use Function::Parameters; use Log::Any qw($log); +use Path::Tiny; =encoding utf-8 @@ -27,6 +28,9 @@ method new($class: $db_path, $cache_size) { bless $self, $class; if (! -f $db_path) { + # ensure the cache directory exists + path($db_path)->parent->mkpath({mode => oct(700)}); + my $db = $self->_open_db($db_path, $cache_size); $self->initialize_db(); } else { diff --git a/lib/App/BorgRestore/Settings.pm b/lib/App/BorgRestore/Settings.pm index 26a175e..557a097 100644 --- a/lib/App/BorgRestore/Settings.pm +++ b/lib/App/BorgRestore/Settings.pm @@ -6,7 +6,6 @@ use warnings; use App::BorgRestore::Helper; use autodie; -use File::Path qw(mkpath); use Sys::Hostname; =encoding utf-8 @@ -124,9 +123,6 @@ for my $configfile (@configfiles) { } $cache_path_base = App::BorgRestore::Helper::untaint($cache_path_base, qr/.*/); -# ensure the cache directory exists -mkpath(get_cache_dir(), {mode => oct(700)}); - sub get_cache_dir { return "$cache_path_base/v2"; } |