From 07ce64512c6075b20e26466f79ca4215f781aa28 Mon Sep 17 00:00:00 2001 From: Rick Daniel Date: Mon, 11 Jul 2016 02:17:42 +0100 Subject: [PATCH] enabled absolute path in backup_dir --- config.yaml | 3 ++- lib/util.rb | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/config.yaml b/config.yaml index 7b98bef..2edbea3 100644 --- a/config.yaml +++ b/config.yaml @@ -54,7 +54,8 @@ } # Target directory for the backup files - # It his is a relative path it will be relative to the script's directory + # If this is a relative path it will be relative to the script's directory + # Absolute path starts with '/' or '~' backup_dir: './output' # Maximum number of messages to backup for each target (0 means unlimited) diff --git a/lib/util.rb b/lib/util.rb index 6c22598..b189fa0 100644 --- a/lib/util.rb +++ b/lib/util.rb @@ -17,7 +17,15 @@ def get_full_name(user) end def get_backup_dir - File.expand_path(File.join('..', '..', $config['backup_dir']), __FILE__) + parent_dir = + case $config['backup_dir'][0] + when '/', '~' + $config['backup_dir'] + else + ['..', '..', $config['backup_dir']] + end + + File.expand_path(File.join(parent_dir), __FILE__) end def get_media_dir(dialog)