Skip to content

Commit 5a37d9a

Browse files
authored
Merge pull request #30 from araishikeiwai/absolute-path
enabled absolute path in backup_dir
2 parents 46055f7 + 07ce645 commit 5a37d9a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

config.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
}
5555

5656
# Target directory for the backup files
57-
# It his is a relative path it will be relative to the script's directory
57+
# If this is a relative path it will be relative to the script's directory
58+
# Absolute path starts with '/' or '~'
5859
backup_dir: './output'
5960

6061
# Maximum number of messages to backup for each target (0 means unlimited)

lib/util.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ def get_full_name(user)
1717
end
1818

1919
def get_backup_dir
20-
File.expand_path(File.join('..', '..', $config['backup_dir']), __FILE__)
20+
parent_dir =
21+
case $config['backup_dir'][0]
22+
when '/', '~'
23+
$config['backup_dir']
24+
else
25+
['..', '..', $config['backup_dir']]
26+
end
27+
28+
File.expand_path(File.join(parent_dir), __FILE__)
2129
end
2230

2331
def get_media_dir(dialog)

0 commit comments

Comments
 (0)